Editor's note: Ann Marie Murphy is an associate professor at the John C. Whitehead School of Diplomacy and International Relations, Seton Hall University, and an associate fellow at the Asia Society.
(CNN) -- Since Egyptian president Hosni Mubarak resigned in the face of widespread demonstrations, attention has shifted to what comes next.
Fears have been raised that Egypt's transition may follow the Iranian path, where the Shah's overthrow led to a repressive Islamic regime that turned away from the West and became a source of regional instability.
Indonesia provides a better analogy for Egypt than Iran. Over the past decade Indonesia, home of the world's largest community of Muslims, has made a successful transition to democracy that clearly refutes the proposition that Islam and democracy are incompatible.
Those who invoke the Iranian model for Egypt fear that by providing an opportunity for the Muslim Brotherhood to contest elections, democracy will create a theocracy.
But whether democracy empowers radicals -- religious or secular -- or tames them depends on a whole host of factors. In Indonesia, like Egypt, political Islam was suppressed during the 32 years of Suharto's military-backed rule and some feared that religious extremists would hijack the transition.
These concerns were heightened when the al Qaeda-affiliated terrorist groups Jemaah Islamiya launched a series of deadly terrorist attacks, including the 2002 Bali bombings that killed 202 people.
Such fears proved unfounded: In three free and fair parliamentary elections Islamic parties have fared poorly, winning less than 30% of the vote in 2009 although almost 90% of Indonesians are Muslim.
Islam may be important in Indonesian private life, but the electorate responds to campaigns promising good governance, anti-corruption measures and economic prosperity, all key demands of the Egyptian protest movement.
Moreover, Indonesia has instituted one of the world's most successful counter-terrorism programs, signed a Comprehensive Partnership with the United States, and become a linchpin of regional stability in Southeast Asia.
The Indonesian lesson for Egypt is that when people are freed from oppressive regimes, they do not embrace extremism, they reject it.
As Egypt embarks on its political transition, with the military promising elections within six months, the Indonesian experience offers a number of lessons.
First, for the elections to be free, fair and credible, the military should not attempt to oversee them itself. It should create an independent election commission and appoint representatives from all major constituencies to write campaign rules, vet political parties and register voters.
Elections inevitability produce winners and losers. If the electoral process is not conducted in a non-partisan and transparent manner, it will lack the integrity necessary to induce those on the losing side to accept defeat, rather than challenge the outcome. A contested election could stall Egypt's political transition, perhaps fatally.
Second, the military should immediately free the press, release political prisoners and strive to ensure that the diverse segments of Egyptian society who united to overthrow Mubarak now work together to lay the foundations for Egypt's political future.
The willingness of Suharto's successor to take such steps early in the transition was critical for Indonesian democracy. The pivotal role that social media played during the protests illustrates the futility of attempting to clamp down on free speech.
As Egypt builds new political institutions, ensuring that all stakeholders participate in open debate over their shape will lend critical legitimacy. Towards this end, the appointment of both a Coptic Christian and a member of the banned Muslim Brotherhood to the eight member panel charged with amending the constitution is a hopeful sign.
Finally, and perhaps most contentiously, the military needs to reconcile itself to a future in which power flows from the people.
The Indonesian military's suppression of dissident meant it was perceived as a discredited institution by many, a sharp contrast from Egypt where trust in the military appears high.
The military's relative weakness helped Indonesian reformers assert civilian control, but even there it took six years for the military to relinquish its reserved seats in parliament.
In Indonesia today a reformist former general, Susilo Bambang Yudhoyono, serves as president after twice winning direct presidential elections.
Whether the Egyptian military retreats to the barracks will depend on many factors, including whether officers hold democratic values and whether they believe democracy will protect the military's legitimate institutional interests and provide opportunities for officers to pursue their own political interests.
Political transitions are always fraught with challenges, and sometimes end badly, as in Iran. The Indonesian example offers a more optimist vision for Egypt's future.
During the demonstrations, both the protestors and military exhibited a keen awareness of the danger of violence and went to great lengths to avoid it.
This bodes well for Egypt. Egypt's political future will be determined by its own citizens, but as Egyptians search for models, Indonesia, not Iran, offers more valuable lessons.
The opinions in this commentary are solely those of Ann Marie Murphy.