Ever since Egyptians occupied Cairo’s Tahrir Square to face down former President Hosni Mubarak last year, Western diplomats and analysts have hoped aloud that the most populous and politically important Arab nation might follow the “Turkish Model.”

They were wrong then, but they may be right now.

Sunday’s decision by Egypt’s election commission to acknowledge the results of the country’s first free presidential elections -- a win for the Muslim Brotherhood’s Mohamed Mursi -- was heartening. The alternative, a stolen election, would have been depressing and had unpredictable consequences.

But the Egyptian military’s attempt to dismiss parliament and eviscerate the president’s office ahead of the vote is a clear sign of a stunted democratic system in the making -- one that’s all too familiar to Turks.

Until the last decade, civilian governments in Turkey operated within strict confines delineated by the military. Sometimes, as in 1971 and 1997, the generals forced governments out with blunt or veiled threats. Sometimes, as in 1960 and 1980, they asserted themselves in an armed coup. On a daily basis, the courts and other state structures -- some extra-legal -- helped enforce the military’s will. Turks called this the “deep state,” a phrase meant to express the shallow nature of the country’s democracy.

Wrong Model

This isn’t the Turkish model you usually hear about -- one in which a predominantly Muslim nation is ruled by a civilian and moderately Islamist government committed to free-market democracy. Unfortunately, Egypt appears determined to follow the earlier version of the Turkish model.

The relatively prosperous and democratic Turkey we know today is still very much evolving. It has existed only since about 2007, when the ruling Justice and Development Party, better known as AKP, took on the military over the right to elect former Islamist Abdullah Gul as president, and won. The government responded to its victory by effectively putting the armed forces on trial. Hundreds of officers, including dozens of generals, remain behind bars awaiting verdicts.

The Turkish and Egyptian militaries have a lot in common. Both see themselves as defenders of the state from an Islamist takeover. Both built vast economic empires at home: Turkey’s Oyak Group remains one of the country’s biggest conglomerates, funded by military pensions and making everything from Renault cars to cement. Both militaries enjoy, despite everything, deep wells of popular trust as effective institutions that in the relatively recent past carried out armed feats of national importance.

The first lesson to draw in Egypt from the Turkish model is that a military that ran the nation for decades will have deep roots in the establishment and among significant parts of the population who are frightened of what Islamists may bring. It won’t give up easily. This is a process that will probably take years, and may involve a long period of cohabitation between rival centers of power.

Second, the U.S. should recall that it was a key sponsor of the military in Turkey -- a North Atlantic Treaty Organization member and an important Cold War ally -- and was widely resented by Turks for supporting the generals through thick and thin. That changed after the Cold War, but deep skepticism over U.S. motives lingers among Turks today, as it does in Egypt. As we have said before, the U.S. should strictly condition the $1.3 billion in aid it gives to the Egyptian military based on its democratic record. Right now, that record is poor.

Military Parallels

Finally, Egypt’s military can draw lessons of its own from the Turkish experience. Turkey’s military has felt lingering humiliation since 2007, when it warned in a statement about Gul’s election that it was ready “to protect the unchangeable characteristics of the Republic of Turkey” against threats “in the guise of religion,” but was unable or unwilling to follow through. The civilian authorities are now using the same politically charged judicial system against the military that the generals abused for so many years in suppressing real and imagined radical Islamists.

The two countries’ situations are also different, of course. Unlike Turkey, Egypt isn’t trying to join the European Union and isn’t a member of institutions such as the Council of Europe. These were important tools the AKP used against the Turkish military. The Muslim Brotherhood is also more Islamist than the AKP, and Turkey’s gross domestic product per capita is more than twice that of Egypt.

Still, Egypt’s generals should take note that it was a major geostrategic event -- the end of the Cold War and the fall of communism -- that weakened the support, domestic and international, of their Turkish counterparts. The Arab Spring could yet play a similar role in the Middle East.

Unlike Egypt, Turkey had no revolution in which the armed forces intervened to protect ordinary protesters -- an extraordinary opportunity for Egypt’s generals. If they carry through with the current move to stay in charge by gutting efforts to build up democratic institutions, they will only polarize the nation against them.

The end result would likely be as in Turkey: humiliation and jail, with much suffering along the way.

Read more opinion online from Bloomberg View. Subscribe to receive a daily e-mail highlighting new View editorials, columns and op-ed articles.

Today’s highlights: the editors on the Supreme Court’s ruling on Arizona’s immigration law; Margaret Carlson on Rielle Hunter; Noah Feldman on Justice Kennedy’s liberal moment; William Pesek on Thailand’s former prime minister; Ramesh Ponnuru on who Romney’s running mate will be; Richard J. Carroll on modern U.S. presidents’ economic performances.

To contact the Bloomberg View editorial board: view@bloomberg.net.