Two Iraqi security guards on the grounds outside the building were slightly wounded, security officials said on condition of anonymity because they were not authorized to speak to reporters.
An Associated Press reporter ran outside and saw a crater one-meter in diameter about 50 meters from the building where the news conference was in progress. Two cars were damaged.
Al-Maliki security officials said it was a rocket attack. U.S. helicopters were quickly in the air headed in the direction from which the rocket was fired.
Small chips of debris floated down from the ceiling above the U.N. chief after the big explosion rattled the building in the Green Zone. He looked frightened, casting his eyes right and left as he rose after ducking behind the podium where he was standing and answering questions next to the prime minister.
Al-Maliki said "nothing's wrong" as one of his security men started to grab the prime minister. The two men quickly resumed answering questions. The rocket landed as one of Ban's questions was being translated. They ended the question and answer session minutes later.
The sound of the weapon being fired — which sounded like a rocket launch — could be heard not far from The Associated Press office, which is across the Tigris River to the east of the Green Zone, which also houses the U.S. Embassy and Iraqi government offices.
Al-Maliki had just finished telling reporters that Ban's visit was a sign that Iraq was on the road to stability.
"We consider it (visit) a positive message to world in which you (Ban) confirm that Baghdad has returned to playing host to important world figures because it has made huge strides on the road toward stability," al-Maliki said in his opening remarks.
Ban and al-Maliki were speaking to reporters after meeting for about one hour in the heavily fortified Green Zone. Ban was to leave Baghdad later Thursday after the first visit by the top U.N. official in nearly a year and a half. His predecessor, Kofi Annan, was in the Iraqi capital in November 2005.
"The new Secretary General is making a point with his travels — that he is willing to play an activist role in diplomacy," said CBS News foreign affairs analyst Pamela Falk from the U.N. Thursday. "And given how many international crises are brewing right now, his role is being welcomed by most nations."
In other developments: