LONDON (Reuters) - Somalia’s government and its foreign backers on Thursday signed a security pact which they presented as a road map toward building a functional national army capable of taking on the fight against al Shabaab militants.

The al Qaeda-linked Islamist militant group has lost much of the territory it once controlled in Somalia, including the capital Mogadishu, but its deadly attacks remain one of the main obstacles to stability in the chaotic Horn of Africa country.

A London conference on Somalia also heard that the United Nations was increasing its appeal for the country by $900 million to a total of $1.5 billion to allow aid agencies to cope with a severe drought that is causing a humanitarian crisis.

U.N. Secretary General Antonio Guterres said the extra funding was needed because more than 6 million Somalis -- about half the country’s population -- were in need of assistance. He said 275,000 malnourished children were at risk of starvation.

The conference tackled a wide range of issues, from Somalia’s requests for debt relief to calls for easier access to the international banking system, but British Foreign Secretary Boris Johnson said the security pact was the main achievement.

The pact, a 17-page document released at the end of the conference bit.ly/2qwfMby, follows a detailed agreement reached in April between Somalia's fledgling federal government and its member states on how to unify their disparate forces into a national army and police force.

“What the international community want to do now is to back that security architecture, and the stronger and more robust it is ... then the more the international community will be able to come in with support,” Johnson told reporters.

Slideshow ( 8 images )

As things stand, an African Union force made up of soldiers from Kenya, Ethiopia, Uganda, Burundi and Djibouti is doing most of the fighting against al Shabaab insurgents, but it wants to start withdrawing from Somalia in 2018.

The AU force has clawed back control of most of Somalia’s main towns and cities since the militants were driven out of Mogadishu from 2010, but it is over-stretched and funding is a constant challenge.

SEEKING BETTER GUNS

Somalia’s President Mohamed Abdullahi Mohamed, who took office in February after a complex Western-backed electoral process, called for a lifting of the arms embargo on Somalia to give his armed forces an advantage over al Shabaab fighters.

“Al Shabaab has AK-47s and the Somali national forces has the same equipment, the same weapons, and that’s why this war has been lingering for 10 years. And if we don’t have more sophisticated and better weaponry definitely this war will continue for another 10 years,” he told a news conference.

Mohamed said he was not asking for that now, but rather when Somalia had achieved some of the milestones set out in the security pact. He talked about a period of eight months or more.

Slideshow ( 8 images )

Johnson said now was not the time to consider lifting the arms embargo.

“We shouldn’t be thinking of doing it that way round. The priority has got to be .. to help the Somali forces to get to a condition ... where they are able to take on al Shaabab,” he said.

Somalia has been mired in violent chaos since 1991, when warlords overthrew dictator Siad Barre and then turned against each other.

Analysts say the national army is poorly equipped and underfunded, with troops sometimes going unpaid for months.

Partly as a result of that, a range of regional forces including clan militias, the Ethiopia-backed Ahlu Sunnah Wal Jamea militia, the U.S.-supported Puntland forces and a regional force in Jubaland have been reluctant to join a centralized force.

The April agreement between the federal government and member states and Thursday’s security pact are aimed at overcoming these difficulties.

(This version of the story has been corrected to changes date of militants leaving Mogadishu to 2010 from 2007, paragraph 9)