Five years ago, President Obama made a decision that helped topple Egyptian President Hosni Mubarak. His policy represented a bet that the democratic surge of the Arab Spring could lead to a stable political transition in Egypt and elsewhere in the Middle East.

Obama’s embrace of the Tahrir Square protesters’ demand for Mubarak’s immediate departure was idealistic, popular and understandable at the time. But it was arguably among the biggest mistakes of Obama’s presidency. And, interestingly, it’s an issue where Hillary Clinton was much closer to being right than the president.

Because these events helped shape the Middle East turmoil that has increased year by year since 2011, it’s worth reviewing them. This is not just a history lesson: The story bolsters Clinton’s case that she analyzed major foreign policy issues correctly during her time as secretary of state. The record suggests that if her advice had been followed, the United States might be in a stronger position in the Arab world today.

Clinton sent Obama a prophetic warning in January 2011 as the Egyptian crisis was beginning, which she quotes in “Hard Choices,” her 2014 book: “It all may work out fine in 25 years, but I think the period between now and then will be quite rocky for the Egyptian people, for the region, and for us.”

Clinton narrates the basic story in her memoir: With protesters occupying Tahrir Square, Obama sent Frank Wisner, a respected former ambassador to Egypt, to meet with Mubarak on Jan. 31, 2011. The message was that Mubarak must pledge not to run again for president and begin a peaceful transition. In a televised speech the next night, Clinton writes, Mubarak “had actually come around to much of what Wisner had asked of him, but it was too little, too late — both for the crowds in the streets and the team in the Situation Room.”

The question then became whether to push Mubarak publicly toward an immediate transition. “Senior Cabinet officials, including me, counseled caution,” Clinton recalls. “But other members of the team appealed once again to the president’s idealism and argued that events on the ground were moving too quickly for us to wait. He was swayed.”

Obama went on television the night of Feb. 1 and said the transition “must begin now.” With that, the die was cast: The Muslim Brotherhood, the strongest opposition force in Egypt, had been late to join the uprising but now moved to take advantage of it. Clinton and Wisner continued to urge caution, but Obama chided them for sending “mixed messages” that undercut the White House line. The Tahrir protests escalated, the army refused to intervene, and Mubarak resigned on Feb. 11.

“Those of us who favored the stodgy-sounding ‘orderly transition’ position were concerned that the only organized forces after Mubarak were the Muslim Brotherhood and the military,” Clinton writes. She had that exactly right, as the past five years have demonstrated.

The exuberant protesters in Tahrir Square were irresistible, not just for Obama but for most of the world. But even in the streets, it was obvious that Egypt (with U.S. backing) was taking a risk. “The Egyptian people are making a bet that the Brotherhood won’t wreck their new experiment in democracy. But as is always the case with real political change, it’s impossible to be sure,” I wrote at the time, after watching hundreds of thousands of Egyptian Muslims in celebratory mass prayers in Tahrir Square, “an image that evokes Tehran more than Cairo.”

One of history’s “what ifs” is what might have happened had Wisner been allowed to continue talking with Mubarak about a gradual change of power. In an interview Thursday, Wisner argued: “We ought to have been calling for an orderly transition, rather than telling Mubarak ‘get out of town, get out of government,’ with no strategy for what happens next. We needed a responsible path to stability and evolution, not revolution.”

Nobody could have forecast the catastrophic chain of events that followed the Tahrir Square uprising. The coup in the streets led to the election of (now-former) President Mohamed Morsi; his abuses triggered a counter-coup by the Egyptian military. Emboldened by events in Egypt, Muslim revolutionaries (with U.S. help) toppled a dictator in Libya and are still trying to overthrow one in Syria. And the rulers of Saudi Arabia are still traumatized by the United States’ abandonment of Mubarak.

Many people got Egypt wrong. One of the few people who got the basics right is Clinton. That’s a card she should play more effectively in this campaign.

Read more from David Ignatius’s archive, follow him on Twitter or subscribe to his updates on Facebook.