When both the Egyptian military and supporters of ousted President Mohammed Morsi are accusing the United States of betrayal, it’s tempting to think that the Obama administration must be doing something right. But the breadth of the discontent may simply be a reflection of the administration’s inconsistent policy.

Last week, Secretary of State John Kerry said on Pakistani TV that the Egyptian armed forces were “restoring democracy” when they overthrew Morsi. Kerry’s comment was unjustified and offensive; previously, the U.S. had treated Morsi’s removal as a fait accompli but had stopped short of accepting its legitimacy.

Ironically, Gen. Abdel Fattah Sisi, the head of the armed forces, has denounced the U.S. for not embracing what he described as a popular uprising against Morsi. He also suggested that the Obama administration had been remiss in not pressuring Morsi to reach out to his political opponents.

Both these complaints have some validity. The U.S. should have been more vocal in criticizing Morsi’s highhandedness, not only because he was violating democratic norms but also because it was obvious that his actions were tempting intervention by the armed services.

Once Morsi was removed, the response of the U.S. — that it was “deeply concerned” by his overthrow — was short on the appropriate indignation. The administration further undermined its credibility when it reacted with muted criticism to attacks on protesters in which scores were killed.

This country can’t micromanage political developments in Egypt, but with a more disciplined message the U.S. will have a better chance of nudging all parties in Egypt toward what Kerry called an “inclusive” political evolution.