Mubarak: Egyptian statesman of war and peace
Hosni Mubarak was a military man; but one who upheld his country's commitment to international peace.
Under his leadership, Egypt took a leading role in trying to broker a deal between Israel and the Palestinians.
His three decades in power came to an end in 2011, when a popular uprising forced him from office.
He faced criticism for using a state of emergency to crack down on political opponents; and the final years of his life were spent battling charges of corruption.
Muhammad Hosni Said Mubarak was born on 4 May 1928 at Kafr-El Meselha, in northern Egypt.
Despite a poor background, he graduated from Egypt's Military Academy in 1949. He transferred to the air force, where he was commissioned in 1950.
He spent two years flying Spitfires and became a flight instructor. He witnessed General Gamal Abdel Nasser's military coup in 1952 and the Suez conflict which followed.
In 1959, Mubarak travelled to the Soviet Union - a major arms supplier to the new Egyptian government - where he learned to fly bombers.
He married Suzanne - a 17-year-old doctor's daughter; and worked his way steadily up the ranks, becoming head of the Air Force Academy and then Air Force Chief of Staff in 1972.
But it was in his next role - Commander of the Egyptian Air Force and Deputy Minister of Defence - that he made his name.
Mubarak was instrumental in planning the surprise attack on Israeli forces at the start of the 1973 Arab-Israeli war.
The raid took place on Yom Kippur, the holiest day of the Jewish calendar. Mubarak became a national hero for the role the air force played in the initial thrust across the Suez Canal.
Russia and the United States came close to superpower conflict as they rushed to supply their respective allies. Israel repelled the invasion; but eventually ceded Sinai back to Egypt.
Mubarak's reward came two years later, when President Anwar Sadat made him vice-president.
Sadat specialised in what he called his "electric shock" foreign policy. He expelled 16,000 Soviet advisors, visited Jerusalem while technically still at war, and frostily refused to meet Saudi leaders.
Mubarak mainly stuck to domestic affairs, but began to build strong personal links with fellow Arab leaders - in particular Saudi Crown Prince Fahd.
He was not a noted supporter of the 1979 Camp David peace agreement - signed by President Sadat and the Israeli Prime Minister, Menachem Begin.
The treaty sharply divided the Arab world. Mubarak regretted Sadat's failure to prevent relations with moderate allies deteriorating; and radical groups were inflamed at what they saw as a sell-out.
In October 1981, soldiers sympathetic to one such group assassinated Sadat during a parade commemorating his victory in the 1973 Arab-Israeli conflict.
The assassins hid in a truck, which stopped opposite the president. Thinking they were part of the parade, he stepped forward to salute them.
They threw grenades and fired indiscriminately into the crowd with AK-47 rifles. Sadat died in hospital two hours later; Hosni Mubarak was among the injured.
Mubarak succeeded to the presidency, receiving 98% of the vote in a national referendum - in which he was the only candidate.
He promised to uphold the Camp David agreement, but relations with Israel were notably frostier than under Sadat. Commentators began to describe it as a "cold peace".
Egypt and Saudi Arabia - the Arab world's most populous and richest states - also joined forces to resist the growing power of Ayatollah Khomeini's Iran.
Egypt - expelled from the Arab League in 1979 - was readmitted, and the organisation's headquarters returned to its original home on the banks of the Nile.
Mubarak had been educated at a Soviet military academy and spoke Russian, but was keen to strengthen relations with the West.
His crucial role in the Israel-Palestinian peace process cemented his relations with successive American presidents, who supplied him with billions of dollars of aid.
Critics accused him of being an American puppet, the imprisonment and torture of dissidents, and of rigging elections.
He expanded the internal state security forces, and survived at least six attempts on his life - sustaining injuries from a knife-wielding assassin in Port Said.
Iraq's invasion of Kuwait in 1991 was a blow to Mubarak, who claimed he had received a promise from Saddam Hussein that no such action was planned.
While backing sanctions as the main international response, Mubarak pledged military support to the coalition against the Iraqi leader.
Saddam called for the overthrow of the Egyptian government; but billions of dollars of debt wiped out by the United States and other international creditors.
A decade later, Mubarak withheld support from the 2003 US-led invasion of Iraq. He said it would lead to the creation of "100 Bin Ladens" and stated his belief that a resolution of the conflict between Israel and the Palestinians was the region's top priority.
He was re-elected in unopposed referendums in 1987, 1993, and 1999. There was a multi-party election in 2005, but the state's internal security apparatus and electoral system remained firmly under Mubarak's control.
He was successful in attracting foreign investment, though its fruits often failed to reach those in greatest need. There were reports that the Mubarak family fortune was as much as £50 billion.
In January 2011, Egypt erupted. There were weeks of demonstrations by protesters frustrated by poverty, corruption, unemployment and autocratic rule.
His promise not to contest the forthcoming presidential election was not enough. After 18 days of protests, he bowed to the inevitable and announced he was stepping down.
Just four months later, a now ailing Mubarak was ordered to stand trial. Lying on a hospital bed, he faced charges of corruption and the premeditated murder of protesters.
His defence team initially claimed that he was legally still president of Egypt, and therefore not subject to the court.
In June 2012, Mubarak was sentenced to life imprisonment for failing to prevent the killing of protesters - but cleared of other charges. The decision triggered a series of protests on the streets of Cairo.
Six months later, the sentence was overturned and a retrial ordered. He was placed under house arrest at a military hospital in Cairo.
In a succession of judgements, Mubarak was cleared of corruption charges but convicted of embezzlement.
In 2017, Egypt's highest court finally acquitted him of responsibility for the deaths of the protestors - and he was released.
Hosni Mubarak lacked the flamboyance of his immediate predecessors, Nasser and Sadat; but vowed that he would continue to serve Egypt until his last breath.
During his three decades in power, Egypt remained a relatively stable country. But many were imprisoned without trial and tortured.
Internationally, Mubarak maintained a foreign policy that aimed to defuse regional conflict; but at home he ruled with an iron fist.