Barack Obama is getting hell from the left and the right for his handling of the people’s revolution in Egypt.

Critics on the left, like Niall Ferguson, in a new column in Newsweek today, argue that the President should have pulled the rug from beneath Hosni Mubarak and openly aligned the U.S. with the protesters in Tahrir Square from the outset.

Critics on the right, like Glen Beck and others, chastise Obama for failing to publicly support our “ally” Mubarak .

Since Obama did neither, Obama’s performance is being dubbed a “foreign policy debacle” and a “colossal failure.”

Wrong, on both counts.

This was a case, not uncommon in diplomacy, where ambiguity was the highest and best use of the bully pulpit. If the President had come down decisively in favor of the protesters, it would have pushed Mubarak out all the more quickly. But it would also have given the revolution a “Made in America” label and stripped it of its legitimacy.

Instead, the President spoke repeatedly of the need for an orderly transition that would accommodate the legitimate desires of the protesters and all Egyptians. Going forward, he should do exactly the same thing. Rather than endorse this candidate over that, or even this general over that general, the Administration should stick to the principles of democracy and openness and equality.

If the U.S. adopts and stays with that posture there is a chance — just a chance — that this extraordinary, grass-roots revolution will result in elections and a democratic government later this year. It is crucial that the outcome be seen as the choice of the Egyptian people, not that of Washington-based foreign policy commentators from the left or the right.