Abdullahi Yusuf, a former guerrilla warrior who became president of Somalia only to see his administration crumble under a ferocious Islamic insurgency, died March 23. He was 78.

Abdirahman Omar Osman, a government spokesman, said Mr. Yusuf died at a hospital in Dubai, United Arab Emirates. The cause was complications from pneumonia, Mr. Yusuf’s family announced.

Mr. Yusuf served as president of the Transitional Federal Government of Somalia from 2004 to 2008. He had battled chronic health problems for years and had a liver transplant in 1996. He survived several assassination attempts, including a suicide car bombing in 2006 that killed his brother and several bodyguards.

Mr. Yusuf’s administration struggled to assert control in Somalia after assuming power in 2004, when the country’s first government in 13 years was formed with the help of the United Nations. At his inauguration — held in the Kenyan capital of Nairobi because of security concerns — Mr. Yusuf pronounced himself “a man of peace” and urged Somalis to begin to forgive one another.

After an Islamic alliance took control of the Somali capital in 2006, Mr. Yusuf invited Ethiopian troops into the country. The Ethiopian advance quickly routed the Islamist forces, but the memories of previous Somali-Ethiopian wars and the presence of soldiers from a majority Christian nation in a mainly Muslim country made the Mr. Yusuf’s government unpopular.

The situation also encouraged Ethiopia’s archenemy, Eritrea, to offer the Islamists assistance, making Somalia a proxy war zone. The Islamists quickly launched an Iraq-style insurgency.

Mr. Yusuf’s government also was weakened by internal struggles. Mr. Yusuf was operating far from his power base in the semiautonomous northern region of Puntland. Clan squabbles and public disagreements with his prime minister over foreign aid led many Somalis to see the government as divided, corrupt and ineffective.

Somalia has not had a fully functioning government since 1991, when dictator Mohamed Siad Barre was overthrown. Barre and Mr. Yusuf had been military colleagues, but Barre imprisoned Mr. Yusuf after he refused to take part in the coup that bought Barre to power in 1969.

While in prison, he became friends with warlord Mohamed Farah Aideed, whose battle with U.S. soldiers in the early 1990s inspired the book and movie “Black Hawk Down.”

Three years after his release in 1975, Mr. Yusuf tried to overthrow Barre but failed and fled to Kenya, where he recruited members for his guerrilla movement.

Mr. Yusuf, who had studied in Italy and the former Soviet Union, was backed by the socialist government of Ethi­o­pia. But Mr. Yusuf later quarreled with the Ethiopians over their claims to Somali territory. Ethiopian dictator Mengistu Haile Mariam imprisoned Mr. Yusuf in 1985, and he was released only when the Mengistu regime fell in 1991.

Mr. Yusuf spent much of the 1990s in his native Puntland, where he sought semiautonomous status in an effort to save the region from the chaos engulfing the rest of the nation. Aides described his style as ruthless, and many of his opponents were jailed or killed. There also were sporadic clashes over territory with the neighboring region of Somaliland, and he was deposed for a year over his attempts to increase his term of office in 2001.

Mr. Yusuf regained control of Puntland in 2002 with Ethiopian help, forging an alliance with the new Ethio­pian government. Mr. Yusuf was elected Somalia’s president in 2004, having systematically undermined several other attempts at forming a government.

— Associated Press