U.S. Secretary of State Hillary Clinton speaks during a press conference with Somalian President Hassan Sheikh Mohamud following meetings at the State Department in Washington, D.C., on January 17, 2013. (Saul Loeb/AFP/Getty Images)

The United States formally recognized the government of Somalia on Thursday for the first time in more than two decades, marking what the Obama administration declared a major policy success in bringing that country back from near-collapse.

“Today’s meeting has been a long time in the making,” Secretary of State Hillary Rodham Clinton said alongside Somali President Hassan Sheik Mohamud after the two met privately in Washington. “Four years ago, at the start of the Obama administration, Somalia was, in many ways, a different country than it is today,” she said.

The brightening picture in Somalia, long considered the world’s ultimate failed state, posed a stark contrast to the situation on the other side of Africa, in Mali, where militants allied with al-Qaeda occupy the northern half of the country and are battling French forces trying to stem their advance.

While some conservatives have criticized the administration for failing to “lead” in Mali, officials described the U.S. strategy there as similar to that in Somalia, where a U.S.-backed African military coalition — along with selective targeting of militant leaders by U.S. drone and aircraft strikes — has made significant strides against extremists who until recently occupied large swaths of Somali territory and much of Mogadishu, the capital.

Political progress in Somalia appeared to catch up with military gains in September, when a newly elected parliament chose Mohamud as president, ending years of “transitional” governments deemed ineffective and corrupt.

After four months of relative peace and institution-building, administration recognition marked the reestablishment of full bilateral relations for the first time since the overthrow of military dictator Mohamed Siad Barre in 1991.

“It’s a great day,” Mohamud said in remarks at the Center for Strategic and International Studies after his appearance with Clinton and a White House meeting with President Obama. He said U.S. recognition would allow direct American aid and encourage other countries and international financial institutions to follow suit.

Mohamud said his top priorities were security and judicial and financial management reform. While there is “no silver bullet,” he said, and Somalia is “very much aware of all past mistakes, we are ready to move on.”

Over the past four years, the administration has supplied more than $1 billion in indirect assistance to Somalia, the bulk of it in support of the African military coalition.

Mohamud was effusive in his gratitude to the United States, noting that U.S. aid had built schools, seaports and airports and provided humanitarian assistance during droughts and famine at a time when Somalia was “so close to being wiped out.”

“American boys and girls in uniform have sacrificed their lives to save Somali lives,” he said.

Somalia is known primarily in this country as the scene of “Black Hawk Down,” the book and movie that recounted the 1993 death of 18 U.S. military personnel in a Mogadishu battle with fighters loyal to Somali clan leader Mohamed Farah Aideed. During the years that followed, U.S. intelligence operatives attempted to support various sides in clan warfare as an Islamist insurgent group, al-Shabab, grew in strength.

In 2007, al-Shabab declared its allegiance to al-Qaeda. Beginning that year, an African Union force composed largely of troops from Uganda, Djibouti and Burundi has steadily pushed back against al-Shabab forces. Under the Obama administration, those forces have been aided by targeted U.S. airstrikes.

The tide began to turn against al-Shabab early last year, when Kenyan forces joined the African coalition. In September, after the election that ended the last transition government, Kenyan-led forces captured the southern city of Kismayo, the al-Shabab stronghold.