I FIRST met Mohammed Morsi, Egypt’s first democratically elected president, in May 2010. He was a longtime leader in the Muslim Brotherhood, the country’s largest opposition group. It was a dark time in Egyptian history, with repression intensifying.

Morsi would have never dreamed, then, that Egypt’s ruling party would be ousted in the 2011 Arab Spring and that he would be elected president, only to be overthrown by a military coup a year later.

Just as the Brotherhood’s fortunes changed so quickly, so too would U.S. interest in and commitment to Arab democracy. The Obama administration reverted to business as usual, backing authoritarian regimes with little respect for their opposition.

The Brotherhood won an unprecedented 88 seats in the 2005 parliamentary elections. In the 2010 polls — arguably the most fraudulent in Egyptian history — the party couldn’t even win a single seat. In 2011, President Hosni Mubarak fell, opening the way for Morsi to ascend.

Unlimited Digital Access. $1 for 4 weeks.

The Muslim Brotherhood and its fellow travelers in the region were not naive about the challenges Morsi faced.

As the Brotherhood’s leader Essam el-Erian told me that year, “The people won’t accept an Islamist president. They feel that anyone Islamist will provoke antagonism from the U.S. and Europe.”

Erian was only half-right. Despite longstanding American discomfort with Islamist movements — which believe that sharia, or Islamic law, should play a more central role in political life — the Obama administration was willing to accept the Brotherhood’s victories at the polls and worked to establish a working relationship with President Morsi.

Yet the relationship was plagued by a basic lack of trust. Before the Arab uprisings, successive U.S. administrations had kept their distance from the Brotherhood. So when the group did finally rise to power, American policymakers had to effectively start from scratch.

Any well-intentioned efforts to reach out to the Morsi government were undone by the military coup of July 3, 2013, and the subsequent crackdown. The U.S. reaction hearkened back to American policy in the early 1990s, when George H.W. Bush’s administration tacitly supported a military coup in Algeria against democratically elected Islamists.

After the 2013 Egyptian coup, Secretary of State John Kerry claimed in a remarkable statement that the Egyptian military was somehow “restoring democracy” by ousting democratically elected President Morsi. Later, he claimed that the Brotherhood had “stolen” the Egyptian revolution.

This is what Islamists call the “American veto” — the conviction that the United States and other Western powers will simply not allow them to win.

Fair or unfair, it is the conclusion they, and many others, have reached three years after the Arab uprisings ushered in the hope that the U.S. might align itself with the region’s democratic aspirations. Democratic ideals aside, turning a blind eye to repression is a shortsighted approach.

Islamist movements are part of the fabric of their societies, reflecting a widespread desire for Islamic law to play a larger role in political life. Eradicating the Brotherhood, as the military regime in Egypt is currently attempting, is a fool’s errand. Previous attempts have failed.

The Egyptian regime in the 1950s, Tunisia’s in the 1990s and the Syrian regime in the 1980s could all claim some success, at least in the short-term. But, even in Syria where the Brotherhood was almost entirely wiped out, the group re-emerged in 2011 as one of the country’s strongest political forces.

With this in mind, the U.S. should resist pressure from Egyptian leaders and establish regular, not just ad hoc, channels of dialogue with the Brotherhood and other Islamists, including those in exile, and closely coordinate such outreach with the European Union.

Should the United States fail to effectively engage the Muslim Brotherhood and other opposition groups, it may again find itself unable to have constructive relationships with parties that rise to power in the future — just as it did in 2011 after Mubarak fell.

This requires long-term thinking. One of the lessons of the Arab Spring is that planning for eventualities is a must. After all, in just a few years, American policy — and Egypt’s fortunes — have seemingly come full circle.

When I first met him, Morsi was in the ranks of the opposition, bracing for the worst. The Brotherhood then experienced its meteoric rise to prominence and power. Now Egypt’s ex-president spends his days in prison, wondering what might be next.

Shadi Hamid is a Washington, D.C.,-based Brookings Institution fellow at the Saban Center’s Project on U.S. Relations with the Islamic World. He is author of “Temptations of Power: Islamists & Illiberal Democracy in a New Middle East.”