On 10 October 2004, in a session held by the Transitional Federal Parliament (TFP) in the neighbouring Kenyan capital of Nairobi, Ahmed was elected as President of the Transitional Federal Government (TFG), an interim federal administrative body that he had helped establish earlier in the year. He received 189 votes from the TFG Parliament, while the closest contender being, former Somali Ambassador to the United States Abdullahi Ahmed Addou, got 79 votes in the third round of voting. The then incumbent President of Somalia, Abdiqasim Salad Hassan, peacefully withdrew his candidature. Ahmed was sworn in a few days later on 14 October 2004.