Hosni Mubarak, the autocratic ruler of Egypt whose nearly 30 years in power came to an abrupt, bloody climax in 2011 after a popular revolt swept across the Arab world, died Feb. 25 at 91.

State media reported the death but did not provide further details.

Mr. Mubarak lived to see the demise of the revolution that overthrew him. It was at best grim satisfaction for a president who rose to power in 1981 after the assassination of President Anwar Sadat and had kept a tight grip on his country through decades of repression, corruption and cronyism, only to be deposed by the military after massive street protests during the Arab Spring uprisings.

A war hero who styled himself as a bulwark against Islamist extremism, Mr. Mubarak portrayed his regime as indispensable to the West — and to the United States in particular. He wooed American presidents, drawing encomiums from Ronald Reagan and Bill Clinton as an indispensable partner in keeping the peace in a region where that was a rare commodity.

Compared with his predecessor, Mr. Mubarak was considered flat and uncharismatic. He was a leader without flash or flair, and he had no taste for surprises. Egyptians said he had no personality. He was not a natural politician. But he was brutally efficient.

He declared an emergency law — in place throughout his entire presidency — that allowed him to keep political opponents in prison without being charged or going to trial. Many of his prisoners were tortured and executed.

Mr. Mubarak’s aura of invulnerability quickly evaporated in 2011. Violent clashes between security forces and protesters left hundreds dead. Yet the protests persisted — for 18 days in all — inspired by a rebellion that began in Tunisia and came to be known as the Arab Spring.

Under mounting pressure, Mr. Mubarak agreed on Feb. 11, 2011, to cede his powers to a military council leadership. Egyptians rejoiced wildly at the announcement, the first sign that an Arab leader would be held to account for widespread corruption and repression.

He was ordered to stand trial on charges including involvement in the killing of protesters in Cairo’s Tahrir Square and the embezzlement of tens of millions of dollars from state coffers; his two sons, accused of vast corruption, also went on trial.

Anti-Mubarak Egyptians cheered the sight of the deposed strongman scowling from behind a metal cage in the courtroom. “I never did anything wrong,” Mr. Mubarak declared at one of his trials. He presented himself as an ailing man, donning sunglasses and entering the courtroom on a stretcher after flying via helicopter from his comfortable room at a military hospital.

With Mr. Mubarak out of power, the country descended into chaos. Mohamed Morsi, a leader of the long-banned Muslim Brotherhood, was elected president in 2012. Morsi barely lasted a year. He never gained the confidence of the state security apparatus, and his incompetence as a politician lost him support among workaday Egyptians fed up with the rapidly sinking economy and fears that he was pushing for an Islamist-backed constitution.

Another mass gathering in the streets led to a military junta seizing control in 2013, under Gen. Abdel Fatah al-Sissi. Determined to crush dissent, the new government massacred hundreds of supporters of the ousted Morsi that summer. Mr. Mubarak’s fortunes seemed to reverse with Sissi in charge.

At his first trial, in 2012, Mr. Mubarak was given a life sentence for the deaths of protesters. Thousands took to the streets in fury that he had not been sentenced to hang. An appeals court overturned the verdict, and he was exonerated at retrial.

However, he and his sons Alaa and Gamal were found guilty of siphoning state money for personal use, sentenced to three years each in prison and ordered to pay $20 million in reimbursement. It was widely perceived as a token amount, given that the Mubarak family reportedly had $433 million stashed in Swiss bank accounts, according to a Swiss government official.

The rulings paved the way for Mr. Mubarak’s eventual release. In March 2017, at the age of 88, he walked out of detention a free man. He was whisked off to a mansion in the Cairo suburbs. The activists who had packed Tahrir Square in the pan-Arab uprising that forced him from power greeted his release in sullen silence, the promise of their revolution long since lost. Ordinary Egyptians, beset by economic ills and terrorist threats, and witnessing Sissi’s brutal treatment of dissenters, responded with weary indifference.

Hero in Arab-Israeli war

Mohammed Hosni Mubarak was born in the Nile Delta village of Kafr el-Meselha on May 4, 1928. His father was an inspector in the Justice Ministry.

After high school, Mr. Mubarak attended the Egyptian military academy and then the air force academy. He was commissioned as a pilot in 1950, during an era when the Egyptian military depended on Soviet equipment and assistance.

In 1959, he moved to the Soviet Union for further training. Mr. Mubarak excelled in an environment in which Soviet instructors drilled into their students an aggressiveness and attention to detail.

“He enjoyed flying; he was born for the sky,” Boris Pogozhev, a retired Soviet officer who gave flying lessons to Mr. Mubarak, once said in an interview with a Russian news website. “Mubarak learned pretty good Russian, including slang. He understood Russians very well. . . . After his first independent flight, we had a party — that was a tradition. And Mubarak was at his best — drinking vodka without wincing.”

Mr. Mubarak rose quickly in the military and was named commander of the air force in 1972, when he was 44. He was regarded as a hero for his role directing an air campaign against Israel in the 1973 Arab-Israeli war over disputed border territories on the Sinai Peninsula.

Two years later, he was named vice president under Sadat. Mr. Mubarak largely handled the day-to-day running of the country and was often sent by Sadat to handle regional issues with Egypt’s Arab neighbors. He became known for his shrewd diplomacy.

Mr. Mubarak played a key role in negotiating the Camp David Accords in 1978, under which Egypt became the first Arab country to recognize Israel’s right to exist. The 1978 signing of the accords was a historic moment, and Sadat and Israeli Prime Minister Menachem Begin shared the Nobel Peace Prize for their efforts.

But Egypt was ostracized by the rest of the Arab world for what was considered an act of betrayal. Sadat was gunned down during a military parade outside Cairo by Islamic fundamentalist militants, who reportedly opposed Sadat’s policies toward Israel.

Turning against the U.S.

As president, Mr. Mubarak never wavered in his commitment to the course that Sadat had charted with Israel.

He was by no means a friend of the Israelis, who often expressed annoyance with him, but he maintained a “cold peace” with his eastern neighbors and kept Egypt mostly out of war.

He largely cooperated with Israel on its blockade of the Gaza Strip, even while members of his intelligence service worked closely with Hamas, the Palestinian militant organization that controls the strip and that the United States and other Western countries consider a terrorist group. Despite the blockade, which began in 2007, Palestinian militants in the Gaza Strip were plentifully supplied with weapons smuggled through tunnels that connected the territory to Egypt.

By the mid-1980s, Mr. Mubarak had reestablished ties with his Arab neighbors. As the leader of the most populous country in the Arab world, he wielded considerable diplomatic sway in the region. He was a frequent — but mostly ineffective — intermediary between Israel, Washington and the Palestinians.

During the 1991 Persian Gulf War, Mr. Mubarak considered Saddam Hussein’s invasion of Kuwait to be an act of reprehensible aggression. He sent 45,000 Egyptian troops to war against Iraq with the U.S.-led forces. Mr. Mubarak won $10 billion in debt forgiveness as a reward.

Under Mr. Mubarak, Egypt achieved greater prosperity than it had ever known. After the Sept. 11, 2001, attacks, he became a close ally of the United States in combating terrorism and cast his regime as a shield against Islamist extremism. (He was rewarded handsomely for his long-term cooperation with the United States. During his last year in office, total U.S. assistance to Egypt amounted to about $1.5 billion, most of it for the military.)

In the 2000s, Mr. Mubarak’s attitude toward the United States began to change. At first, he collaborated with the George W. Bush administration in the campaign against international terrorism. During Bush’s second term, relations turned icy over Mr. Mubarak’s reported abuses against prisoners and political dissidents.

The Bush administration began a vigorous campaign to push Mr. Mubarak to accept democratic reforms as part of its “freedom agenda.” Pressured by Washington, Mr. Mubarak acceded to demands in 2005 to have multiparty elections for the first time since he became president.

In what was not considered an open election, Mr. Mubarak handily won his fifth consecutive term in office that same year. Invigorated by his victory, he acted defiantly toward the United States and denounced Bush administration policies involving democratic initiatives.

The roots of a revolt

A stark discontent lurked beneath the seemingly staid surface. Moving away from state ownership of enterprises, Mr. Mubarak instituted a system of sanctioned monopolies rather than endorse a free market.

The big monopolies, as well as the police, the military and the intelligence services, all reported separately to the top — to Mr. Mubarak. It was a stovepipe system that gave him authority over a broad swath of Egyptian life, and it made him very rich.

Corruption mushroomed and became a weight on the whole society, suppressing growth and, over time, exasperating and finally infuriating ordinary Egyptians.

The popular revolt that led to Mr. Mubarak’s ouster was organized by youth groups fed up with the lack of political liberty. Using social media platforms such as Facebook, younger, generally urban Egyptians created a vast network of like-minded rebels and rallied together to foster change.

In the end, the Egyptian people didn’t trust Mr. Mubarak to make any significant reforms after decades of stagnancy. In writing their own drama, they spelled the end of Mr. Mubarak’s reign.

Mr. Mubarak married Suzanne Sabet in 1959. In addition to his wife, survivors include their two sons.

During his last decade in office, Mr. Mubarak began to groom his son Gamal to succeed him as president. He eventually installed Gamal as secretary general of the ruling National Democratic Party. Although father-son succession is a typical practice within autocratic states, the possibility of the arrangement fueled discontent among the Egyptian people.

Mr. Mubarak believed that only an Egypt under the control of a man of his strength and will could hold back the forces of extremism in the Arab world. The Middle East, he told CNN in 2002, “will be the biggest source of terrorism, more and more. It will generate a new generation of terror. . . . We will have to be very careful. If you don’t believe it, sometime you’ll believe what I’m saying.”

Adam Bernstein contributed to this report.