CAIRO (Reuters) - Hosni Mubarak, who died on Tuesday, never expected to be president. But when a very public assassination thrust the former bomber pilot into the job, he made it his mission never to give it up.

His story became Egypt’s story for the next 30 years until, finally, his people found they could write it themselves, in a 2011 Arab Spring revolution that consigned him to history.

An unremarked vice president to Anwar Sadat, he was a stopgap in the anxious days of 1981 after Sadat was gunned down beside him at a military parade. Few thought he would last.

Yet slowly, surviving attempts on his own life, he became “Pharaoh”, presiding over decades of stagnation and oppression and offering his people a choice: Mubarak or mayhem.

Many believed him, not just in Egypt. U.S. administrations showered him - and the biggest army in the Middle East - with billions of dollars in gratitude for his loyalty to Sadat’s Cold War switch of allegiance and peace with Israel.

But it was his struggles with the Islamists - who by killing Sadat handed power accidentally to a man who would spend 30 years suppressing them - which defined his politics.

Yet to the question of how Egyptians should be governed in the future, he never had an answer beyond “Mubarak” and always refused to indicate a successor. Washington expected him to go on rigging elections till he died, when his son Gamal might take over.

“Nobody imagines that we can press a button and freedoms will arrive. Otherwise it would lead the country to chaos and that would be a danger to people,” Mubarak once said.

Mubarak died aged 91 on Tuesday after undergoing surgery, state television said.

HUMBLE BEGINNINGS

Mubarak was a 24-year-old air force pilot when the military overthrew King Farouk in 1952.

Slideshow ( 5 images )

The son of a government clerk, he was born Muhammed Hosni El Sayed Mubarak in the Nile Delta village of Kafr Musailha on May 4, 1928, when Egypt was still heavily supervised by Britain, which controlled the Suez Canal.

Details of his early life are sketchy. He qualified as a pilot in 1950 and spent more than two years in the Soviet Union a decade later, training to fly bombers.

When much of the air force was wiped out by Israeli warplanes in the Six-Day War of 1967, he was made head of the air force academy, charged with rebuilding air power to hit back. As head of the air force from 1972, he did just that, attacking Israel in 1973.

Sadat, who succeeded Gamal Abdel Nasser in 1970, saw in Mubarak a loyal subordinate and made him vice president in 1975.

That office would lie vacant under Mubarak, who guarded his power jealously.

As president, Mubarak sent the army in to quell mutineers in the 1980s, and also repaired relations with Arab states after Sadat’s peace with Israel. In 1989, Egypt was readmitted to the Arab League, which moved its headquarters back to Cairo.

American money made sure that Egypt never wavered from an arms-length civility toward the Jewish state, and Mubarak played mediator between Israel and the Palestinians down the years.

His policies irritated many in the Middle East. After Hamas Islamists took control in the Gaza Strip, adjacent to Egypt, in 2007, Mubarak backed the Israeli blockade of the territory.

Violence by Islamists at home, including attacks on tourist sites and Red Sea resorts, remained a justification for the police state. In 1995, Mubarak survived one of several assassination attempts when Islamist gunmen fired on his car during a visit to Ethiopia.

A command economy fashioned under the Arab socialist Nasser lagged behind countries Egypt was once compared to, such as Turkey or South Korea. Egypt’s population almost doubled under Mubarak, but many remained mired in deep poverty.

Slideshow ( 5 images )

A spurt of growth in his final decade, fuelled by market reforms overseen by his son Gamal, made some rich, but corruption ensured the wealth stuck to the elite around the head of state, the military and those who found favour in the National Democratic Party (NDP).

Politically, there was talk of reform, not least when former U.S. President George W. Bush was pushing the idea. After winning a series of single-candidate referendums that provided the legal basis of his rule, Mubarak agreed to contest a presidential election in 2005. But the defeat of Ayman Nour, a liberal lawyer who dared challenge him, was no surprise.

REVOLUTION

By 2010, the NDP felt confident enough of its impunity to claim 90% of the seats in a parliamentary election that saw the Muslim Brotherhood eliminated from the legislature.

The resulting public outrage might have subsided, as it had before, had it not been for the sudden success of an uprising in Tunisia just a few weeks later which also prompted protests against Egypt’s ruler.

At first, Mubarak gave little ground to the hundreds of thousands of demonstrators in Cairo’s Tahrir Square, comforted by hesitation in Western capitals to cut loose an ally.

Only when his generals began to desert him, fearful their own privileges might be swept away, and the Americans sided with the popular will, did he relent, at first insisting he would retire only later but finally flown off to his Red Sea retreat.

“Egypt and I shall not be parted until I am buried in her soil,” he said. He was arrested two months later.

A trial began in August 2011, the sight of Mubarak in a courtroom cage captivating viewers.

On June 2, 2012, just before Brotherhood candidate Mohamed Mursi won the presidency, Mubarak was jailed for life for conspiring to murder protesters, sent to Cairo’s Tora Prison though occasionally moved to the smart Maadi military hospital nearby due to claims of failing health.

Prison time would be short, however, as another military man, Abdel Fattah al-Sisi, overthrew Mursi the following year.

As Sisi launched a crackdown on the Brotherhood that critics said was more severe than anything under Mubarak, the case against the former president was dropped in 2014.

Three years later, following an appeal by the prosecution, Egypt’s top appeals court acquitted him, allowing him to return to his home the upscale Cairo neighbourhood of Heliopolis, not far from the presidential palace he had occupied for nearly three decades.