Cairo (AFP) - Egypt's former president Hosni Mubarak ruled with an iron fist for 30 years before being deposed amid street protests, defending his chequered reign to the end.
He died Tuesday aged 91.
Once dubbed "the Pharaoh" for his long, autocratic rule, he was swept from power, like other regional potentates, by the popular uprisings of the 2011 Arab Spring.
His mixed legacy is that of a strongman who employed emergency powers, led a police state and rigged elections, and of a guarantor of stability who battled jihadists, maintained close ties with the West and kept peace with Israel.
A former air force chief, he became Egyptian vice president and then, in 1981, head of state after Islamist militants assassinated his predecessor Anwar Sadat during a military parade.
Mubarak was also wounded, having sat next to Sadat in the attack by jihadists who had infiltrated the army.
He would survive several more attempts on his life, most dramatically in 1995 when militants sprayed his motorcade with bullets at a roadblock in Addis Ababa, Ethiopia.
Mubarak was the fourth president of the Arab Republic of Egypt, which was founded in 1952 when the military overthrew the monarchy.
He was considered neither an inspirational revolutionary like Gamal Abdel Nasser, who ruled from 1956 to 1970, nor a charismatic politician like Sadat, who succeeded Nasser and led Egypt until 1981.
But his diplomatic prowess showed on the international stage where he proved to be a deft statesman.
He maintained Egypt's peace treaty with Israel -- the reason Sadat was assassinated by militants -- and became a main player in the US-sponsored Israeli-Palestinian peace process more than a decade later.
Born on May 4, 1928 in the Nile Delta village of Menufiyah, Mubarak went on to rise through the air force ranks before becoming vice president and then Egypt's leader.
Seen as a somewhat bland politician, he earned the moniker "The Laughing Cow", after the mascot of a processed cheese brand, an image that would be sprayed on Cairo walls during the Arab Spring protests.
Critics say that during the Mubarak years the government and economy were hobbled by rampant corruption, bureaucratic mediocrity and rights abuses.
Mubarak did not introduce Egypt's police state, but under him the secret police, known to torture and disappear opponents, came to control almost every aspect of daily life.
"We knew everything about everyone," said one senior secret police official after Mubarak's overthrow.
The stifling police state impacted society and culture.Even as Egypt's population boomed during the Mubarak era, the Arab world's one-time intellectual and cultural centre faded as a regional power.
On the plus side, Mubarak has been credited with bringing economic reforms in the 2000s.
Under the direction of his unpopular son Gamal, who was groomed to take over the presidency, the government began a programme of economic liberalisation.
At the same time, and largely in response to US pressure, Mubarak in later years began to ease his grip of political life.
An independent and often critical press flourished, and protests were largely tolerated, despite police occasionally beating up and arresting demonstrators at Cairo rallies.
In 2005, Mubarak emerged the winner of what observers said was Egypt's latest rigged election.His principal opponent, Ayman Nour, was later jailed.
In the last years of Mubarak's reign, it was unclear whether he was truly in charge or had devolved many of his responsibilities to his son Gamal, then a senior party figure.
Mubarak's ouster came in the heady Arab Spring days, soon after Tunisians overthrew their leader Zine El Abidine Ben Ali in 2011.
Egyptian activists took to the streets on January 25 and quickly hundreds of thousands demanded Mubarak's departure.
Within three days Mubarak had sacked his cabinet in a gesture to the protesters, presenting them with a tough choice: either he stayed or chaos would follow.
Later, the military decided that Mubarak could not remain in power any longer.
On February 11, he was flown to a Red Sea resort far from Cairo, leaving his hastily appointed vice president to announce his resignation and the onset of military rule.
That announcement on national television sparked jubilation by millions in Egypt.
Mubarak was later arrested and put on trial over the deaths of protesters during the 18-day revolt as well as for corruption.
Once a robust man and a keen squash player, Mubarak was wheeled into court on a stretcher, his sunglasses barely disguising his look of disgust as lawyers and prosecutors demanded he be hanged.
He was condemned to life in jail in 2012, but an appeals court ordered a retrial.
During his detention, Mubarak denied wrongdoing.
"When I heard the first verdict I laughed.I said: 'Ha!'," Mubarak told a private broadcaster after his 2012 sentencing.
"I did nothing wrong at all," he said.
By 2017, he was cleared of all charges brought against him and released.
His two sons, Alaa and Gamal, were also sentenced in a graft case, but were released after time served.
Mubarak spent his final days in a military hospital, leaving only occasionally.
Pictures of him appeared from time to time online in the resort town of Sharm el-Sheikh, a town which he had developed as a tourist hub.
Many Egyptians, fatigued by a revolution that failed to bring tangible democratic and economic change, have increasingly begun to pine for Mubarak's days.
He is survived by Alaa and Gamal and by his half-Welsh wife Suzanne.