EGYPT HAS REACHED the most dangerous moment yet in 17 months of revolutionary — and counterrevolutionary — turmoil. A runoff presidential election is due to take place on Sunday in which a loyalist from the former regime of Hosni Mubarak is a candidate; meanwhile, the courts and military command of that old regime have dissolved the parliament that was chosen in Egypt’s most democratic election in more than half a century. The writing of a new constitution is in limbo. If former prime minister Ahmed Shafiq is declared the winner of the election, the military-backed autocracy that governed Egypt from 1952 to 2011 could return.

The generals may hope that Egyptians fed up with a deteriorating economy and rampant crime will welcome such a restoration. More likely would be a bitter and possibly bloody conflict between the resurgent remnants of the former regime and Islamist movements that won the parliamentary election, with the secular liberals who led the January 2011 revolution caught — and perhaps crushed — in the middle. The result would be a disaster not only for Egypt and the cause of democratic change in the Middle East but also for the interests of the United States.

The best way out of this predicament is a resumption of the democratic process. That means a free and fair presidential election on Sunday, and the military’s acceptance of a victory by Muslim Brotherhood candidate Mohammed Morsi if that is the result. Any attempt by the regime to manipulate the vote or the counting is likely to be detected — and must be quickly and resolutely opposed by the United States and other Western governments.

The Supreme Military Council, which has ruled the country since Mr. Mubarak’s ouster, must then be pressed to fulfill its promise to hand over power to a civilian government by June 30. The generals may try to impose their own constitution; they have no legal mandate or legitimacy to do so. If the decision to dissolve parliament sticks, then a new one must be elected as quickly as possible. The military’s reinstatement of martial law must not be used to stop free speech and free assembly.

Secretary of State Hillary Rodham Clinton touched on several of these points Thursday, saying that “there can be no going back on the democratic transition called for by the Egyptian people.” Unfortunately, the Obama administration undercut its credibility with Egyptians and its leverage over the military in March when it decided to hand over $1.5 billion in military aid, waiving pro-democracy conditions that had been imposed by Congress.

The generals may have been encouraged to believe that the United States would accept further backward steps, such as the dissolution of the parliament. For that reason, the administration must now be clear in its public and private communications to Cairo: If the democratic process is not restored, U.S. relations with the Egyptian military will be ruptured.