NAIROBI (AFP) - Veteran politician and soldier Abdullahi Yusuf Ahmed won Somalia's presidential election and promised to do all he could to rebuild his country which has been devastated by years of factional fighting and lacked a proper government since 1991.
If he failed, he would quit, he pledged, after winning a third round run-off ballot of Somali lawmakers held in a sports stadium on the outskirts of the Kenyan capital, Nairobi.
Somalia's own capital, Mogadishu, with its squabbling and heavily armed rival factions, was considered too dangerous a venue for the election.
In the run-off, Yusuf, who has served as president of the autonomous northeastern region of Puntland since 1998 and as a faction leader and army officer before that, trounced his rival, former diplomat and minister Abdullahi Ahmed Adow, by 189 votes to 79.
Twenty-four other candidates who entered the race earlier Sunday were either eliminated in the first two rounds or withdrew.
On being announced the winner, Yusuf stood by an unfurling Somali flag -- a white star on a blue background -- to the cheers of hundreds of spectators.
A Kenyan police band played Somalia's national anthem.
"Having given me the honour by electing me I pledge before you and the international community to work hard to reconcile Somalis to bring back peace and security and restart the country all over again," Yusuf declared in the Somali language.
Since the 1991 fall of dictator Mohammed Siad Barre, Somalia has lacked almost all the trappings of a functional state, such as national systems of education, healthcare and justice.
"I will also disarm militias," he added.
One of Yusuf's first tasks as president will be to name a prime minister who will form a new government. A mediation official from the two-year-long negotiations that culminated in Sunday's vote said Yusuf might not be officially sworn in till well into next week.
"I will do my best to serve but if I am unable I will go back to parliament and ask them to elect another president," he promised, before calling for international troops to be deployed in Somalia, "to assist us reconstructing."
The African Union has said it was considering sending such a force, but no detailed plan has yet been unveiled.
The last international intervention in Somalia was a disaster. A UN mission deployed from 1992 to 1995 provided famine relief but failed to restore peace, while a US force sent to protect aid workers left hurriedly after 18 troops were killed during a botched mission in Mogadishu in October 1993.
Adow was gracious in accepting defeat.
"I am ready to support the new government in any capacity... I wish that the next government led by Abdullahi Yusuf Ahmed will bring peace and prosperity back to Somalia," he said.
This election followed numerous similar attempts to reconstitute a national government in Somalia.
Most recently, a major conference in Djibouti led to the appointment in 2000 of Abdulkassim Salat Hassan as president of an administration that failed to exert its authority much beyond a few pockets of Mogadishu.
Salat bowed out of Sunday's race after scoring miserably in the first round, and pledged to back the eventual winner.
Before voting began all candidates signed a solemn declaration vowing to acknowledge the vote's outcome and to hand over all firearms and ammunition to the government, the fourth of its kind to be set up outside Somalia by peace conferences since 1991.
Both the president and government will have a five-year mandate, after which general elections are meant to be held inside Somalia.
The international community has also pledged its support for whoever wins the vote.
But the administration in Somaliland, a self-declared independent region in the northwest, has refused to play any part in this electoral process or to recognise its outcome.