Former Egyptian President Hosni Mubarak, who ruled for 30 years until he was ousted in a popular uprising, has died at the age of 91.
A partner of the West in fighting Islamists, Mubarak presided over an era of stagnation and repression at home and was an early victim of the "Arab Spring" revolutions that swept the region.
He died in intensive care a few weeks after undergoing surgery. Egypt's presidency and armed forces mourned him as a hero for his role in the 1973 Arab-Israeli war and the former air force officer will be given a military funeral.
Three days of public mourning were declared and state television played clips of Mubarak with a black ribbon at the corner of the screen.
Mubarak, who was arrested two months after being forced out by the protesters who crammed into Cairo's Tahrir Square in 2011, spent several years in jail and military hospitals.
He was sentenced to life in prison for conspiring to murder 239 demonstrators during the 18-day revolt, but was freed in 2017 after being cleared of the charges.
He was, however, convicted in 2015 along with his two sons of diverting public funds to upgrade family properties. They were sentenced to three years in jail.
Egyptians, who often complained about corruption, oppression and unemployment under Mubarak, had mixed feelings about their former leader as news of his death spread.
"We had good and bad memories," said Sherin Saad, a woman in her 30s, who criticised graft and the privatisation of public firms, which his critics say enriched the elite.
Atef Bayoumi, walking on the Nile Corniche in central Cairo, said: "He was a patriot. Regardless of the final events, he surely did good things for the country."
In contrast, Gamal Eid, a prominent human rights activist, said on Twitter: "My condolences to all tyrants, they lost one today!"
There was no immediate reaction from Western capitals, which had valued Mubarak for preserving a peace treaty with Israel signed by his predecessor Anwar al-Sadat.
"On behalf of Israel's citizens and government, I wish to express my deepest sorrow over the passing of President Hosni Mubarak," said Israeli Prime Minister Benjamin Netanyahu. "President Mubarak, a personal friend of mine, was a leader who led his nation to peace and security."
The United Arab Emirates' minister of state for foreign affairs, Anwar Gargash, said on Twitter that the Arab world had lost a statesman who took significant national and historic positions.
Mubarak did not leave the country after his overthrow, unlike Tunisia's Zine El-Abidine Ben Ali, who fled with his family to Saudi Arabia after being ousted in the first Arab Spring protests.
In contrast, the Mubarak family has stayed in Egypt since 2011 but kept a low profile.
Mubarak had always maintained his innocence and said history would judge him a patriot who served his country selflessly, but for many Egyptians his time in power was a period of autocracy and crony capitalism.
His successor, Mohamed Mursi, lasted only a year in office, however, after mass protests in 2013 led to his overthrow by then defence chief General Abdel Fattah al-Sisi, who is now president.
Mubarak-era figures, meanwhile, are gradually being cleared of charges, and laws limiting political freedoms have raised fears among activists that the old regime is back.
Many Egyptians have credited Sisi for restoring stability, but activists say his relentless crackdown on dissent is worse than anything under Mubarak.
Announcing Mubarak's death, Egyptian TV criticised him for economic mismanagement. New cities he had created in the desert lacked a "comprehensive vision" while he had spent billions on new roads which the government later had to repair.
Timothy Kaldas, non-resident fellow at the Tahrir Institute for Middle East Policy, said that the coverage was seeking to highlight corruption under Mubarak to curb nostalgia for his time in power.