CAIRO: Former Egyptian President Hosni Mubarak has died at the age of 91 after undergoing treatment in an intensive care unit following surgery, state television said on Tuesday.

Mubarak ruled Egypt for 30 years until he was ousted following mass protests in 2011.

He was arrested in April 2011, two months after stepping down, and was in prison and military hospitals until 2017, when he was freed after being cleared of charges of ordering the killing of protesters.

Mubarak had been sentenced to life in prison in 2012 for conspiring to murder 239 demonstrators during the 18-day revolt.

An appeals court ordered a retrial and the case against Mubarak and his senior officials was dropped. He was finally acquitted in 2017.

He was however convicted in 2015 along with his two sons of diverting public funds and using the money to upgrade family properties. They were sentenced to three years in jail.

Many Egyptians who lived through Mubarak’s time in power view it as a period of autocracy and crony capitalism. His overthrow led to Egypt’s first free election, which brought in Islamist President Mohamed Mursi.

Mursi lasted only a year in office 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.

Mubarak had long maintained his innocence and said history would judge him a patriot who served his country selflessly.

(Reporting by Nadine Awadalla and Mahmoud Mourad; Writing by Ulf Laessing Editing by Alex Richardson and Giles Elgood) ((Ulf.Laessing@thomsonreuters.com; Reuters Messaging: follow me on twitter @ulflaessing))