One of the oddities that confront makers of American foreign policy is that it is easier to deal with avowed enemies rather than wayward friends. Policy toward Iran or Syria or North Korea is more straightforward than policy toward Pakistan, Bahrain, or Egypt–all avowed American allies whose actions (suppressing dissent in the case of Egypt and Bahrain, supporting jihadist groups in the case of Pakistan) cause consternation in Washington. How far do we go to signal American displeasure and risk the strategic benefits we derive from our relationships with these states?

That question has been in sharp relief during the course of the Egyptian revolution/coup (revolucoup?) this week. The U.S. has a stake in promoting democracy in Egypt which, over the long run, is likely to make the country more stable and prosperous–but also a major stake in keeping Egypt committed to the Western camp and out of the clutches of Islamists. Those goals collided when the Egyptian armed forces–and millions of ordinary Egyptians–decided that the Muslim Brotherhood government of Mohamed Morsi was heading in an authoritarian–and, just as important, incompetent–direction. So now the army has deposed Morsi. He and hundreds of other Brotherhood leaders appear to be under arrest and Egypt’s future is more uncertain than ever.

The new interim government has promised to hold elections–but what if the Brotherhood wins the next round of balloting? That is not inconceivable, given the Brotherhood’s organizational strength and popularity in rural areas, notwithstanding the disastrous consequences of its recent period in power. Is the Brotherhood to be disqualified from the electoral process? If so, that would be a powerful inducement to Islamists, not only in Egypt but throughout the Muslim world, to give up any commitment to seeking power through peaceful means; it could cause many to embrace the more violent path urged by al-Qaeda and its ilk. That is a definite danger of the military stepping in. On the other hand, if the military didn’t step in, there would have been a danger that the Brotherhood would never be dislodged from power.

In confronting these difficult dilemmas, American policymakers would be well-advised not to outsmart themselves. There is always a temptation in Washington to try subtle stratagems that backfire in practice. That, in fact, is what has happened in Egypt where the Obama administration has managed to alienate both the Brotherhood and its adversaries. The anti-Islamist faction is mad at Washington because of seeming U.S. support for Morsi while in power–an impression furthered by U.S. ambassador Anne Patterson’s ill-advised remarks which seemed to be critical of coup plotters (understandable) while uncritical of the Morsi regime’s undemocratic excesses (inexcusable). Now the Brotherhood is mad at Washington too because of the impression that the U.S. winked at its overthrow.

Obama and his aides would be well advised to return to first principles–where they should have been to begin with. They need to make clear their support for liberal democracy, stressing the importance not just of elections but of checks and balances of the kind that Morsi disregarded while in power. The American ability to affect the outcome is admittedly limited–the only major leverage we have is the military aid we provide to the Egyptian army and that is unlikely to be cut off because it is tied to the continuation of the Camp David Accords. But even if Washington can’t guide events, it should at least make clear its commitment to the principles on which the United States itself is founded–and which we celebrated just yesterday.