JAKARTA - When Egyptian strongman Hosni Mubarak was deposed two years ago, it seemed the Middle Eastern power could learn a few things from Indonesia's experience in making the transition to democracy.
Like Mubarak, president Suharto presided over a majority-Muslim nation for three decades, brooked little opposition, and kept the military on his side as a key player.
A popular reform movement brought down both men, toppling Mubarak in 2011 just as it catalysed Suharto's resignation in 1998.
There is another connection, albeit an ironic one: Suharto's last overseas trip before he stepped down was to Cairo in May 1998.
But for many Indonesian observers of the Middle East, events in Egypt over the past months have accentuated the different ways the two societies managed their transitions.
Even so, Indonesia's experience offers three broad lessons for Egyptians as their new rulers struggle to restore order after the military's ouster of President Mohamed Mursi on July 3.
Lesson One: Cairo has to create a tent big enough to accommodate a broad range of political players and different views on the role of Islam in the state.
Mr Mursi failed to do this as president because he acted largely on his supporters' point of view, instead of working with a sizeable opposition. This proved extremely costly for him and his associates in the Muslim Brotherhood, including its Freedom and Justice Party.
Creating that big tent is a tough task. Egyptians are divided on the role of Islam in politics, even though 90 per cent of the population are Muslim. Studies by think-tanks and election results indicate a slight majority want a greater role for Islamic law. But a significant number do not want a greater role for religion in politics, and have seen its impact on gender equality and minority rights.
As Professor Salim Said of the Indonesian Defence University notes, Egyptian society remains deeply divided. On one side are the secular-liberal elements, including the military. On the other are Islamists seeking a greater role for religion in the state.
It did not help that Mr Mursi, in spite of winning 52 per cent of the vote in the final round of presidential elections in June last year, sought to push through his agenda. He failed, in Dr Salim's words, to realise that "politics is about permanent bargaining".
On the other hand, Indonesia has a broad national consensus on the role of religion in public life, and while it is the most populous Muslim nation, only a small group of people favour an Islamic state.
Not that this has stopped people from trying. The drafters of what would be the preamble to its Constitution in 1945 agreed to remove a clause that would require the state "to implement Islamic law for its followers".
After 1998, several parties tried to reintroduce this, but failed.
Indonesia's founding ideology Pancasila - a five-point set of principles including nationalism, consensus and social justice - acknowledges belief in one God, but leaves followers of major religions free to express their beliefs in their own way.
Over in Egypt, the Muslim Brotherhood's ideology does not favour this approach. But all sides need a broad national consensus that bridges the secular-religious divide to ensure stability.
Lesson Two: The military ought to resist the urge to intervene in the political process.
Egypt's generals were key in Mubarak's ouster and portrayed their move against Mr Mursi after millions took to the streets as one defending the people's sovereignty. But its crackdown on Mursi supporters over the July 27-28 weekend has only fuelled greater anger among a group that feels the army disregarded the popular mandate when it removed Mr Mursi from power.
No doubt, that mandate was fraying, but many viewed the military's intervention as a coup nonetheless.
In Indonesia, elements in the armed forces were reluctant to make a clean break from politics after 1998. But top military leaders recognised the need to respect the democratic process, amid fears by politicians and observers that it would intervene. So while the military did step back, it was not fully detached.
Retired generals continue to enter the political process - once they have stepped out of uniform.
But in the years after Suharto, they resisted pressures to intervene, even though many were unhappy with the diminished role of the military.
Lesson Three: All sides have to respect the rules of the game.
Many in Indonesia expressed dismay at the way in which an elected president was removed - rather undemocratically - in Egypt. But several politicians as well as media editorials also noted how the events were a reminder to those in power in Indonesia that being democratically elected did not give a party or person the right to make key national decisions without consultation or consideration for opposing views.
Dr Ali Munhanif, executive director of the centre for the study of Islam and society at Jakarta's Syarif Hidayatullah State Islamic University, notes that in his discussions with several Egyptian leaders trying to learn from Indonesia's experience, several of them - especially those from Islamic parties - were not comfortable with the idea of public debate essential to a democracy.
"It was difficult for them to grasp the concept of freedom of speech and expression, and tolerance of differences," he said.
Speaking to officials and diplomats this month, President Susilo Bambang Yudhoyono touched on the situation in Egypt and noted that transitions were not easy, as was the case in Indonesia.
But principles which worked ought to be continued, and in Indonesia's case, all parties agreed to retain the country's core principles.
"We can change the Constitution, the laws, so long as we safeguard and preserve and defend our fundamental consensus," he said, adding: "This change must also be democratic, abiding by the norms of democracy. And the change must not be the wish of an elite group, or two or three leaders, but based on the wishes of all the people."
It is rather ironic that Egypt, a society less ethnically and linguistically diverse than Indonesia, should be facing these struggles to reach a consensus.
Indonesia's democracy is still very much a work in progress, as even its leaders admit.
But if Egypt could adapt some of the lessons learnt from Indonesia's transition, it could be a powerful case study for how democracy can still work in the rest of the Middle East.
Get a copy of The Straits Times or go to straitstimes.com for more stories.