(CNN) -- For the first time in more than two decades, the United States has granted official recognition to the Somali government in Mogadishu.
"There is still a long way to go and many challenges to confront, but we have seen a new foundation for that better future being laid," Secretary of State Hillary Clinton said Thursday in a joint news conference with Somali President Hassan Sheikh Mohamud, who stood beaming at her side.
Clinton praised Somalia's actions in reducing the level of extremism since she took office in January 2009, when "Al Shabaab controlled most of Mogadishu and south and central Somalia, and looked like it would gain more territory."
Al Shabaab is a militant Islamist group with connections to al Qaeda.
Somalia was plunged into chaos after dictator Mohamed Siad Barre was overthrown in 1991. Following his ouster, clan warlords and militants battled for control, sparking a civil war and mayhem nationwide.
The nation since then has mostly been under shaky transitional federal governments.
But the final transitional federal government made "unmistakable" progress, Clinton said, with Somali security forces supported by an African Union mission and troops from Uganda, Burundi, Kenya and Djibouti driving Al Shabaab from the nation's cities and towns.
"Al Shabaab has been driven from Mogadishu and every other major city in Somalia," she said.
Even as they were fighting extremists, the country's leaders were working to create a democratic government, and have done so -- with a new president, a new parliament, a new prime minister and a new constitution, she said.
Mohamud was elected president in September.
Clinton noted that the United States supported the changes, providing more than $650 million in aid to the African Union mission in Somalia, more than $130 million to the country's security forces, nearly $360 million in emergency humanitarian aid over the past two years and more than $45 million in development-related assistance to help rebuild the economy.
In addition, U.S. largesse has provided more than $200 million in aid for Somali refugees throughout the Horn of Africa, she said.
With recognition, Somalia now can participate in certain foreign assistance programs, including military training and financing programs, the State Department said.
Clinton, who is soon to step down from her job leading the State Department, vowed that the two countries will continue to work closely together as they confront the ongoing threat of extremism in the region.
"The terrorists, as we have learned once again in the last days, are not resting, and neither will we," she said. "We will be very clear-eyed and realistic about the threat they continue to pose."
She said she looks forward to the re-establishment of a permanent U.S. diplomatic presence in Mogadishu.
The news conference came shortly after President Barack Obama met with his Somali counterpart at the White House, a meeting that Clinton described as "a very strong signal to the people of Somalia of our continuing support and commitment."
Mohamud acknowledged that his country is "emerging from a very long, difficult period" marked by instability, extremism and piracy, and is moving toward an era of peace and development.
"We are aiming to make a valuable contribution to the region and the world at large," he said.
He described the past 22 years as "difficult times" during which "the United States has always been the country that never left Somalia."
He credited U.S. intervention in the early 1990s with having saved more than 300,000 Somali lives. "Had that intervention not been there, it would have been difficult and different today -- the situation in Somalia," he said.
Clinton said Somalia's emergence as a democracy has changed its relationship with the United States: "We have moved into a normal sovereign-nation-to-sovereign-nation position and we have moved into an era where we are going to be a good partner, a steadfast partner, to Somalia as Somalia makes the decisions for its own future."