Egypt’s ousted former President, Hosni Mubarak has died at the age of 91, weeks after undergoing surgery, Egyptian state television said on Tuesday.

Mubarak served as Egypt’s fourth president starting in 1981 until his ouster in 2011 in what became known as the Arab Spring revolution. He was jailed after the uprising but was freed in 2017 after being acquitted of most of the charges.

He was originally sentenced to life in prison in 2012 for conspiring to murder 239 demonstrators during the 18-day revolt – an uprising that sowed chaos and created a security vacuum but also inspired hope for democracy and social justice.

An appeal court in 2014 ordered a retrial that culminated in the case against Mubarak and his senior officials being dropped. An appeal by the public prosecutor led to a final retrial by the Court of Cassation, the highest in the country, which acquitted Mubarak in 2017.

Throughout his rule, he was a staunch US ally, a bullwark against Islamic extremists and other armed groups as well as the guardian of Egypt’s peace with Israel.

Mubarak was born in a rural village in the Nile Delta in 1928. He left behind a complicated legacy as his rule was partly characterised by corruption, police brutality, political repression, and entrenched economic problems.

He joined the Egyptian Air Force in 1949, graduating as a pilot the following year. He rose through the ranks to become the Commander-in-Chief of the Egyptian Air Force in 1972.

Mubarak became a national hero the following year after reports indicated that the Egyptian Air Force had dealt a substantial blow to Israeli forces in Sinai during the Yom Kippur War.

His harsh stance on security enabled him to maintain a peace treaty with Israel.

Under his rule, Egypt remained a key United States ally in the region – receiving $1.3bn a year in US military aid by 2011. 

Mubarak is survived by his wife, Suzanne and his sons, Gamal and Alaa.