Few expected that the little-known vice-president who was elevated to the presidency in the wake of Anwar Sadat’s 1981 assassination would hold on to the country’s top job for so long.
Mr Sadat was assassinated by Islamist militants at a military parade in Cairo, and Mr Mubarak was lucky to escape the shots as he sat next to him.
Since then, he has survived at least six assassination attempts – the narrowest escape shortly after his arrival in the Ethiopian capital, Addis Ababa, in 1995 to attend an African summit, when his limousine came under attack.
Besides his knack for dodging bullets, the former air force commander has also managed to keep a hold on power by positioning himself as a trusted Western ally and fighting off a powerful opposition movement at home.
But with domestic unrest, his regional clout waning, his health failing, and his succession unclear, many questioned how long Mr Mubarak would be able to carry on.
Then, in a televised address on 1 February, following mass protests in Cairo and other cities, Mr Mubarak announced he had decided not to stand for re-election in September.
Protests continued and on 10 February he appeared on state television to say he was handing over powers to his vice-president, but would remain as president.
The following day Vice-President Omar Suleiman made a terse announcement saying Mr Mubarak was stepping down and the military’s supreme council would run the country.
By 24 May, judicial officials announced that Mr Mubarak, along with his two sons – Alaa and Gamal – would stand trial over the deaths of anti-government protesters.
On 2 June he was found guilty of complicity in the murder of some of the demonstrators who took part in the wave of protests that began on 25 January. Along with his former Interior Minister, Habib Al-Adly, he was sentenced to life imprisonment for his crimes.
In January 2013, Egypt’s Court of Cassation allowed an appeal against Mubarak’s and al-Adly’s convictions and ordered a retrial. Mubarak and his sons will also be retried on corruption charges for which they were acquitted.
The new trial was scheduled to begin on 13 April but as it was about to start, the presiding judge said he felt “unease” and was recusing himself. He referred the case to Cairo’s appeals court to select a new panel of judges.
Born in 1928 in a small village at Menofya province near Cairo, he insists on keeping his private life out of the public domain.
Married to a half-British graduate of the American University in Cairo, Suzanne Mubarak, and with two sons, Gamal and Alaa, the Egyptian president had been known to lead a strict life with a fixed daily schedule that began at 0600.
Mr Mubarak seen with this wife, two sons and daughter-in-law
Never a smoker or a drinker, he built himself a reputation as a fit man who leads a healthy life.
In his younger days, close associates often complained of the president’s schedule, which began with a workout in the gym or a game of squash.
Muhammad Hosni Sayyid Mubarak was sworn in on 14 October 1981, eight days after the Sadat assassination.
Despite having little popular appeal or international profile at the time, the burly military man used his sponsorship of the issue behind Sadat’s killing – peace with Israel – to build up his reputation as an international statesman.
In effect, Hosni Mubarak ruled as a quasi-military leader when he took power.
For his entire period in office, he kept the country under emergency law, giving the state sweeping powers of arrest and curbing basic freedoms.
The government argued the draconian regime was necessary to combat Islamist terrorism, which came in waves during the decades of Mr Mubarak’s rule – often targeting Egypt’s lucrative tourism sector.
He presided over a period of domestic stability and economic development that meant most of his fellow countrymen accepted his monopolisation of power in Egypt.
Hosni Mubarak was one of the world’s longest-serving presidents
In recent years, Mr Mubarak felt for the first time the pressure to encourage democracy, both from within Egypt, and from his most powerful ally, the United States.
Many supporters of reform doubted the veteran ruler’s sincerity when he said he was all for opening up the political process.
Leading up to his declaration not to stand again for the presidency, the US had heaped pressure on him to stand aside, calling for an “orderly transition” of power to a more democratic system.
Mr Mubarak won three elections unopposed since 1981, but for his fourth contest in 2005 – after a firm push from the US – he changed the system to allow rival candidates.
Critics said the election was heavily weighted in favour of Mr Mubarak and the National Democratic Party (NDP). They accused the Egyptian leader of presiding over a sustained campaign of suppressing opposition groups, most notably the Muslim Brotherhood.
The length of his tenure, along with his age and possible successors, had all been sensitive subjects in Egypt until January and February’s mass protests allowed the Egyptian people to find a voice.
People around Mr Mubarak said his health and vigour belied his age – although a couple of recent health scares have been a reminder of his mortality.
Rumours about the president’s health gathered pace when he travelled to Germany in March 2010 for gall bladder surgery. They flared every time he missed a key gathering or disappeared from the media spotlight for any conspicuous length of time.
However much Egyptian officials tried to deny them, they kept circulating, with reports in the Israeli and pan-Arab media.
Gamal Mubarak had been groomed for the presidency
The days of mass protests in Egyptian cities prompted Mr Mubarak to finally name a vice-president. On 29 January, intelligence chief Omar Suleiman was elevated to the role in what was seen as an attempt by Mr Mubarak to bolster his support in the military.
Until then there had been no obvious successor but opposition groups had feared his son, 40-year-old former investment banker Gamal Mubarak, was being groomed for a kind of dynastic inheritance dressed up as a democratic transition.
Gamal insisted he had no ambition to be president, but he had been moving steadily up the ranks of the NDP, becoming a leading advocate of economic and political reform.
Historians point out that every president since the revolution of 1952 has come from the military, and Gamal’s civilian credentials may have given him trouble in gaining the support of that important constituency.
In the past, Mr Mubarak had said he would continue to serve Egypt until his last breath. In his speech on 1 February, he said: “This dear nation… is where I lived, I fought for it and defended its soil, sovereignty and interests. On its soil I will die. History will judge me like it did others.”