President Barack Obama has invested a great deal in a “liberal” foreign policy, through his positions on global warming, nuclear proliferation and trade, often putting international interests ahead of U.S. domestic economic concerns. Now, in Egypt, the time has arrived for his investment and promise to bear fruit, or for his foreign policy to fail to the great detriment of America’s standing in the world.

Revolutions happen because the masses are poor and their conditions worsen beyond tolerable, or the educated are frustrated by a manifest lack of opportunity. Rising global food and energy prices imposed the former on Tunisia. The combination of President Hosni Mubarak’s corruption, Cairo’s place as intellectual center of Arab world and rising commodity prices impose both sets of conditions in Egypt.

For revolutions to resolve favorably, the enforcer of sovereign power — in Egypt’s case, the army — must maintain order either by force or popular legitimacy. The Egyptian army, by refusing to use force to squash the challenge to Mubarak’s rule, appears to be gaining popular legitimacy, acting responsibly and maintaining order without bullets.

For revolutions to end without chaos and state entropy, the apparatus of civil administration cannot be dismembered. It is possible to chop off the dragon’s head — the dictator, cabinet and his inner circle — and replace it with more legitimate leaders. As corrupt as Egypt’s civil administration may be, new leaders cannot replace it wholesale, but must reform it piecemeal if Egypt is to finally enjoy robust economic development, pluralistic civic institutions and social progress consistent with Arab values.

This is so complex, because the Egyptian opposition has so many faces, and Egypt is the linchpin of U.S. Middle East policy. Egypt’s posture toward Israel is central to maintaining Middle East peace, or at least to limiting hostilities to low-grade conflicts between Israel and militant elements.

The Muslim Brotherhood and the secular opposition have hardly compatible visions of a legitimate Egyptian government and Arab values — the contrast is as vibrant as America before the electricity and the telegraph, and after satellites the Internet. Promises of tolerance by one or another faction, if one or the other establishes a government, cannot be taken at face value.

And whatever government succeeds Mubarak, it will have to at least optically, if not in substance, abandon some of Egypt’s support for U.S. Middle East policy and take a harder line toward Israel, without destabilizing the region. Short of that, Iraq and others will consider the new regime illegitimate, blame the United States and easily tighten the screws on western oil supplies to great effect; just reducing oil supplies by 5% could raise U.S. gasoline prices to $4.00 a gallon, wholly derailing U.S. and European economic recovery.

Resolving all this would be above King Solomon’s pay grade but President Obama doesn’t get to pick his crises. He has the assets and circumstances compel him — U.S. dependence on Middle East oil — to help engineer a U.S. friendly outcome in Egypt that is also acceptable to regional powers bearing varying degrees of hostility to the United States and Israel.

The Muslim Brotherhood and secular opposition have coalesced around Mohamed ElBaradei, former director of the International Atomic Energy Agency, to negotiate with Mubarak. ElBaradei is well acquainted with President Obama — they have talked many times and he has praised President Obama for his positions on nuclear disarmament and other issues. The United States provides Egypt with billions in aid. Any future Egyptian government will need that money, and western technical support, to build more sustainable economic and political systems.

However, ElBaradei is quite critical of Egypt’s support for the Israeli blockade of Gaza, which the United States supports, and neither he nor another potential leader can gain legitimacy with Iraq, Syria and other Arab states without changes to those Egyptian policies

Economic conditions for Arabs in Gaza are often abysmal, and that blockade is but one area where Egyptian and U.S. policy must be re-engineered, without compromising Israel’s security, or fail. How effectively President Obama can negotiate all that with Mubarak’s successor, to the satisfaction of Egypt’s neighbors, will be the real test of the President’s diplomatic skills and investment in “liberal internationalism.”

With the U.S. recovery so vulnerable to an oil spike, and critics around the world pointing to recent U.S. economic systemic difficulties as evidence of American decline, this is Barack Obama’s moment.

Like the British at Suez after World War II, Obama’s success will determine much about the credibility of U.S. leadership abroad and his presidency at home. This is not a cliché, Sputnik moment — it is much bigger than that.

Peter Morici is a professor at the Smith School of Business, University of Maryland School, and former Chief Economist at the U.S. International Trade Commission.

Peter Morici is an economist and professor at the Smith School of Business, University of Maryland, and widely published columnist. He is the five time winner of the MarketWatch best forecaster award. Follow him on Twitter @PMorici1.