Ban's latest visit to Iraq came under completely different circumstances compared to his last visit in March 2007, when a rocket attack nearby forced him to duck behind a podium during a news conference in Baghdad's Green Zone.
Many analysts have attributed al-Maliki's success in the provincial elections to a vastly improving security situation.
The coalition led by al-Maliki claimed victory in Baghdad and eight other provinces in last weekend's elections, according to the country's electoral commission.
Iraqis voted to elect ruling councils in 14 of the country's 18 provinces.
The vote, aimed at re-distributing political power at the local level, has been widely viewed as a dress rehearsal for national parliamentary elections scheduled for the end of the year.
Electoral officials said on Thursday that al-Maliki's State of Law coalition won 38 per cent of the votes in the capital, followed by allies of anti-US cleric Muqtada al-Sadr and a Sunni party with nine per cent each.
In the country's second biggest city of Basra, the prime minister's followers won 37 per cent of the votes.
Both cities were racked by sectarian violence in the aftermath of the US-invasion of Iraq until al-Maliki ordered a crackdown last spring.
Other secularists and independent parties also fared well in the polls, after being largely swamped by religious parties in the last election in 2005.
By contrast, the Supreme Islamic Iraqi Council (ISCI), until now the dominant party among Iraq's Shia majority, failed to win a single province. They came second in Basra with 11.6 per cent of the votes.
Results were closer in other Shia provinces, and the next weeks will see parties scrambling to form coalitions in the regional councils which elect powerful governors.
Sunni Arab parties won in Nineveh, Iraq's most violent province.
The Sunnis make up the majority there, but Kurds had controlled the provincial government because many Arabs boycotted the vote in 2005.
In Anbar province, where tensions ran high among rival political groups, a Sunni party led by Saleh al-Mutlaq, came first with 17.6 per cent of the votes.
The list of Awakening Council, a group comprising Sunni tribesmen who had turned against al-Qaeda, finished a close second at 17.1 per cent.
US troops have been asked by the local authorities to stand by in case of trouble following the announcement of results.
Voting in Anbar and elsewhere in the country took place without major violence. But US and Iraqi officials fear there could be trouble if the losers fail to accept the results.
Elections will be held later in four northern provinces, three of them in the Kurdish region of the country.