UN Secretary-General Ban Ki-moon walks through the UN compound in Dadaab refugee camp, the world's largest hosting nearly a half million refugees mostly from Somalia, located across the border from Somalia in eastern Kenya last week. Mr. Ban announced that a key UN agency, the UN political office on Somalia, would move to Mogadishu from neighboring Kenya next month.

Nairobi, Kenya — The last time a United Nations Secretary-General was in Somalia’s capital, almost two decades ago, protestors blocked roads with burning tyres and brandished cow skulls to show their outrage.

That was in 1993, in the depths of the country’s civil war, when US forces were withdrawing after the disastrous Black Hawk Down mission and the UN and its 28,000 troops were reviled in Mogadishu.

Eighteen years later, UN Secretary General Ban Ki-moon found an altogether warmer welcome during his surprise visit there last week. Security officials still insisted that he wear a bulletproof vest, and he was sped through the city’s wrecked streets in a convoy of armored personnel carriers.

But the mere fact that such a high-profile figure was able to visit what is still considered the world’s most dangerous capital is testament to what one analyst called the “dramatic improvements” in security there in recent months.

Al-Qaeda-linked Islamist insurgents are on the run, pushed out of their long-held positions in the city, and squeezed by fresh Kenyan and Ethiopian offensives in the countryside.

The country’s famine situation, although still dire with a quarter of a million people facing imminent starvation, is slowly improving, thanks to a massive international aid response during the last six months.

Pirate attacks off Somalia’s coast dropped by two-thirds in November compared to the same month last year, European naval officials reported last week.

Mr. Ban said the timing of his visit was in part to celebrate these gains, and he commended both the Somali government and the African Union (AU) peacekeepers for their efforts to secure such success.

In recognition of these improvements, Ban announced that a key UN agency, the UN political office on Somalia, would move to Mogadishu from neighboring Kenya next month.

It will be the first time in more than a decade that the UN will have significant numbers of international staff permanently based in the Somali capital.

But buried further into his comments was what analysts identified as the real reason for his visit, which was as much about the business of governing Somalia as it was about the symbolism of showing solidarity.

International humanitarian and development donations to Somalia will top $1.2 billion this year, with another $300 million spent on the AU peacekeeping mission.

This support, Ban said, “should not be taken for granted” by Somalia’s Transitional Federal Government (TFG), bankrolled since 2004 by the UN and Western nations including the US. President Sheikh Sharif’s administration, dogged by allegations of corruption, is already slipping behind on a tight reform timetable, named the “road map,” designed to lead to democratic elections scheduled for August next year.

“In my discussions with Transitional Federal Government leaders, I stressed the importance of seizing this moment,” Ban said at a press conference after meeting President Sharif Friday.

“We have a very limited window of opportunity. I am urging the TFG leadership to make decisive, bold political reforms…and provide basic services," Ban said. “We must move ahead, quickly. The deadline is August next year. Further extension of this road map will be untenable.”

The UN has already warned that delays to key reforms – to the constitution, parliament, security agencies and the presidency – will jeopardize future international support.

“I think it’s fair to say the secretary-general’s visit was in large part an opportunity to underline our seriousness about these timetables, and to encourage the TFG to see that there will be no extension,” one senior UN staffer in Nairobi tells The Monitor. “The idea was that there would be a bit of carrot and a bit of stick.”

Few veteran Somalia-watchers hold great hope that the deadlines will be met, however. Infighting between politicians and a self-serving policy agenda could see al-Shabaab or clan warlords return, says Rashid Abdi, senior Somalia researcher with the International Crisis Group.

“The Somali political class may say they are keen on reform, but there’s very little sign in Mogadishu that the government is capitalising on the modest military successes to push their political strategy,” he says.

“They appear in fact to have no such strategy beyond clinging to power. That ineptitude is the tragedy of Somalia," says Mr. Abdi. "There has been a dramatic improvement in security in Mogadishu, and the government now has the chance to move into these liberated areas."

“But the longer they leave these areas un-policed and ungoverned, the quicker we will see criminal elements moving in.”

On the streets of Mogadishu, there was clear recognition that security had improved and that some level of normal life and business was returning.

“It seems that Somalia is getting the attention of the international community again,” Hassan Sheikh Omar, a Somali human rights campaigner, said during Ban’s visit. “It’s good that the UN chiefs should come here and support us, otherwise the pirate and terror rings will take over and Somalia would turn a crime hub in the east Africa.”

But there was also skepticism over whether Ban’s visit, and the promises of solidarity and support he made before he left, four hours later, would have any effect.

“I doubt how his visit would be different from the previous visits of the other officials or leaders,” says Hussein Moalin Maow, a market trader selling watermelons.