John Kerry has made an unannounced visit to Somalia, the first US secretary of state to visit the Horn of Africa nation that is struggling to rebuild after two decades of war and battling an armed campaign by the group al-Shabab.
Kerry will meet Somali President Hassan Sheikh Mohamud, the prime minister, provincial leaders and civilian groups, US officials said.
Details of the trip were based on a dispatch from a reporter who was travelling with Kerry.
Somali officials were also kept in the dark, initially being told a lower ranking official was coming to the country where US troops supported a humanitarian mission in 1992 but suffered heavy losses when they were drawn into the conflict.
The trip "will send a strong signal to al-Shabab that we are not turning our backs on the Somali people and will continue to engage with Somalia until we bring al-Shabab terror to an end", a senior US state department official said.
The US and Western nations pour aid into Somalia to help reconstruction and prevent it from sliding back into the hands of al-Shabab, who still use territory they control to launch attacks there and on neighbouring states, such as Kenya.
Kerry will use the trip to thank the African Union peacemaking force AMISOM for fighting al-Shabab.
With the backing of US unmanned drone strikes, AMISOM and Somali troops have driven al-Shabab out of most of their strongholds.
In February, the US named Katherine Dhanani as ambassador to Somalia.
She is the first US ambassador to Somalia since the early 1990s, when the US pulled out of the country as fighting between rival commanders plunged the nation into chaos.
The US pulled its forces out of Somalia after the 1993 Black Hawk Down incident when a US helicopter was shot down over Mogadishu, killing 18 soldiers.
At that time, it was the deadliest one-day incident since the Vietnam War.
Other Western nations, including Britain, have already opened embassies inside the airport perimeter, which is surrounded by heavy security.
Based in Nairobi
For now, Dhanani will travel to Somalia regularly from a base in Nairobi, an official said.
In a bid to shore up the government and expand its control, Somalia is due to hold a referendum on a new constitution and an election for its president in 2016.
Somalia's president was previously picked by legislators who were themselves nominated, not voted for, by their communities.
The state department official said on Tuesday that Somalia was expected to hold "some form of election" in 2016.
The official said the aim was to have a vote "different from what they've done before".
"It has to be something that shows that they are moving forward in terms of a representative government."