NAIROBI, Kenya -- Wendy Sherman, the under secretary of state for political affairs, visited Somalia on Sunday, becoming the highest-ranking American official to set foot in the country in more than 20 years, the State Department announced on Monday.
Ms. Sherman, the No. 4 official in the State Department, met with Somalia's new president, Hassan Sheikh Mohamud, who was selected in September, and other political and business leaders during her six-hour visit to Mogadishu, Somalia's bullet-riddled seaside capital.
"Under Secretary Sherman stressed her conviction that Somalia is now a place of hope, not of despair," the State Department said in a statement.
In the past several months, Mogadishu has made a notable turnaround, making such a high-level visit possible. A city that once echoed with gunfire and was haunted by emaciated, hollow-eyed famine victims trudging through its streets is now returning to life with new hotels, new cafes and even a dry cleaner.
Of course, the troubles are far from over and suicide bombers routinely strike, including an attack just a few days ago on a new restaurant. Still, Somalia is in far better shape than it has been since the last functioning central government collapsed in 1991, and Western officials say there is a narrow opportunity right now to make sure the country continues this momentum and does not slide back into war.
"Under Secretary Sherman urged the Somali leadership to continue to consolidate gains by helping local governance structures emerge through community dialogue and reconciliation," the State Department said.
One big question is what will happen with the thousands of Ugandan peacekeepers in Mogadishu whose steady pummeling of Islamist militants has paved the way for this renaissance. Some Ugandan officials recently threatened to pull their troops out of Somalia because they were angry that a United Nations investigative panel accused Uganda of backing a brutal rebel group in the Democratic Republic of Congo, which the Ugandans vehemently deny.
On Monday, Ms. Sherman implied that the Ugandans would stay in Somalia, at least for the time being.
"Uganda will continue to play the leadership role it has, both diplomatically and in terms of military security," Ms. Sherman told reporters in Nairobi, according to Reuters.
The United States has contributed millions of dollars to the peacemaking efforts in Somalia; some American officials still see Somalia as a counterterrorism priority because of Somalia's recent history as a home to violent jihadists from around the world.
The Somali government announced Sunday that it had chosen a new cabinet, including Fowziya Yusuf Aden, a woman, as foreign minister, another first.
Correction: November 6, 2012, Tuesday
This article has been revised to reflect the following correction: Because of an editing error, earlier versions of this article misstated Wendy Sherman's rank in the State Department. She is No. 4, not No. 3.
This article originally appeared in The New York Times.