By BRADLEY KLAPPER and ANDREW HARNIK, Associated Press

MOGADISHU, Somalia (AP) — Two decades after dead American soldiers were dragged through the streets of Mogadishu, John Kerry on Tuesday became the first secretary of state to set foot in Somalia, a symbolic visit to show support for the African nation's fledgling government and the United States' readiness to move past a dark chapter in its history.

But as Kerry vowed to deepen America's partnership with a new cadre of Somali leaders, the fact that he never left the airport underscored just how dangerous and unstable Somalia remains after a quarter-century of civil war.

Before returning to Kenya, the top U.S. diplomat stayed a little more than three hours, meeting with Somalia's president and prime minister and several regional chiefs and civil society groups. It was enough time, he said, to see the resiliency of a people determined to reclaim their future from the terrorists and militias that plunged Somalia into what had seemed an endless cycle of conflict. He promised American help along the path of recovery.

"More than 20 years ago, the United States was forced to pull back from your country," Kerry said, invoking the "Black Hawk Down" debacle when 18 servicemen died after Somali militiamen shot down two U.S. helicopters and a subsequent rescue mission failed. "Now we are returning."

The trip was made under tight security. Somalia's government only learned a day ago that Kerry would join the State Department's top Africa official, Linda Thomas-Greenfield, on the trip. U.S. officials closely controlled access to the conference building where the discussions took place, an edifice encased by 6-foot high piles of sandbags and ringed by fencing wire.

The actual meeting room was bleak and dark, illuminated by a single fluorescent light overhead. Down the street African peacekeeping troops sat at picnic tables as oily streaks of airplane fuel glimmered in the Indian Ocean.

"The next time I come, we have to be able to just walk downtown," Kerry told Somali President Hassan Sheikh Mohamud. Downtown, Mohamud replied, "is very different now."

Top of the agenda was the fight against al-Shabab, an al-Qaida-allied group that has terrorized Somalia for the last eight years. African forces and U.S. drone strikes have crippled the organization's leadership in recent years and left the extremists without much of the territory they once controlled or cash flows to reverse their losses.

But as al-Shabab has decentralized, the militants have expanded their activities in Kenya and other neighboring countries. Last month's massacre at Kenya's Garissa University College killed 148 people, mostly students, highlighting the group's capacity to carry out relatively unsophisticated but extremely deadly terrorist attacks well beyond the Somali border.

Somalia has been without a truly functioning, nationwide government for two-and-a-half decades. After warlords ousted dictator Siad Barre from power in 1991, they quickly turned on one another and the fighting has never stopped, making Somalia infamous for its high rates of violence and the proliferation of pirates operating off its coasts. Security began improving earlier this decade as international efforts against al-Shabab gained ground.

"You have known immense suffering from violence, from criminals, from sectarian strife, from dire shortages of food and from an inability to remain safely even within your villages and homes," Kerry said in a video address to the Somali people. He read out an almost identical statement shortly before leaving Mogadishu.

"I visited Somalia today because your country is turning around," Kerry said. "Three years have passed since a new provisional constitution was adopted and a parliament sworn in. With help from (African troops), Somali forces have pushed al-Shabab out of major population centers. A determined international effort has put virtually all of Somalia's pirates out of business."

Yet even as a relative calm has settled over parts of the country, including Mogadishu, Somalia remains fraught with a painful memories for the United States.

American soldiers deployed there in 1992 to stave off a national famine, and President George H.W. Bush dropped in for three days over New Year's to visit the troops. By 1994 they were all gone, the lasting image of their mission that of American corpses being desecrated by a Somali mob.

The Obama administration is banking on Mohamud's government to lead Somalia toward democracy and economic development. The U.S. has provided hundreds of millions in military support to build up and professionalize the army, and is working with Mohamud to try to usher in a broader, more representative government over the next 18 months.

If that effort is successful and stability expands, officials say the U.S. could re-establish an American embassy in the capital before President Barack Obama leaves office. For now, Obama has nominated a career diplomat, Katherine Dhanani, to serve as the first U.S. ambassador to the country since 1991, with the idea of her operating out of Nairobi and making regular trips into Somalia.

Britain, Italy and several other countries already have embassies in Mogadishu.

Kerry said the U.S. will start mapping out where a future U.S. diplomatic mission could be built.

"We all have a stake in your success," he said. "The world cannot afford to have places on the map that are essentially ungoverned. That is why Somalia's return to effective government is an historic opportunity."

___

Klapper reported from Nairobi, Kenya.