The former president of Somalia's Transitional Federal Government has died at a hospital in the United Arab Emirates at the age of 77 following a long battle with liver disease. Abdullahi Yusuf Ahmed, a former warlord, was elected president in 2004, but had few friends left in Somalia by the time he resigned four years later.

Abdullahi Yusuf Ahmed spent a lifetime fighting. He famously led an attempt to overthrow Somali President Mohammed Siad Barre in 1978, but failed, fled to Kenya and then to Ethiopia. There, he formed a rebel force to fight against the Barre regime.

But the Ethiopians turned against him and he was imprisoned in the mid-1980s until 1991, when Siad Barre was finally forced from power.

The Somalia he went home to was chaotic and violent. Warlords were fighting throughout the country for control of territory and resources.

In his homeland, in the northeast, Yusuf put together his own forces and became one of the founders of the autonomous region of Puntland, where his legacy is best remembered.

On the news of his death, the current Minister of State Planning for Puntland, Abdulkadir Hashi, wrote on Twitter that he was "saddened by his passing" and called the late president a "great patriot & friend."

Politically, Yusuf was a hardliner, inflexible and forever a military man who was quick to sideline anybody who stood in his way. His political career was boosted by warlords and others who believed the country needed a leader willing to fight.

He became president of Somalia's first Transitional Federal Government (TFG) after beating out 27 other candidates, one of them being Mohamed Mohamoud, a self-described peace activist who is also from Puntland.

"Abdullahi Yusuf was sidelining anybody who is not strictly on the military side," said Mohamoud. "He was not comfortable with the people who are politically enlightened, politically independent, politically courageous, who is against military rule."

Although he won the election with the backing of the country's warlords, they quickly turned against him when he tried to set up a government in Mogadishu, fearing a federal government would encroach on their territory.

Under pressure from the warlords, he moved the government to Baidoa in central Somalia. Then, growing more concerned about the rising power of the Islamic Courts Union (ICU), he was instrumental in convincing Ethiopia to send troops into Somalia in 2006 to help prop up the TFG.

The move was unpopular with many Somalis. Former presidential candidate Mohamoud said he supported Yusuf's military strategy, but said more thought should have been given to reforming the political system.

"We were not even opposing him, even me I was not opposing him, just because I believe it was appropriate to take Somalia by force first," said Mohamoud. "But after someone takes by force, well, there should be an immediate change of the system to a rule of law."

The Ethiopian incursion backfired for Yusuf. The troops' presence only helped to bolster support for the militant wing of the ICU, which later evolved into the militant al-Shabab.

Sheikh Abdisamad Abdiwahab, a Somalia analyst with Southlink consultants in Nairobi, says Yusuf had also lost the support of the United States, which had supported his stance against the Islamists.

"Initially they were having very high hope, he's going to restore stability and security of Mogadishu, but he failed to do so, contrary to the expectations of the Americans," said Abdisamad. "So they tell him publicly, if you fail to restore the security and law and order, kindly resign."

His fellow politicians accused him of favoring his own Darod clan, which had no clout in Mogadishu or Baidoa. And the international community called him an obstacle to peace for blocking peace deals with the Islamists.

Yusuf resigned in 2008, making way for the current TFG president, former cleric Sheik Sharif Sheik Ahmed.