Yuri Kozyrev / NOOR for TIME Protesters with soldiers on top of armored vehicles drive through the 6th October Bridge during clashes in Cairo on July 5, 2013

Millions of voters elected an Islamic political party to run the country, but the military stepped in, forced out the winners of the election and handpicked a group of politicians in their place. No, this is not Egypt in 2013. It was Algeria in 1992. And in the eyes of some, the bloodshed that followed that fateful Algerian decision 21 years ago offers sobering lessons for the generals in Cairo, who forcibly removed President Mohamed Morsi from office on Wednesday, one year after he’d won a democratic election, igniting violent street fighting between members of his Muslim Brotherhood and the massed ranks of protesters that had pushed for his ouster. “There is indeed a similarity,” Faycal Metaoui, a political columnist for Algeria’s al-Watan newspaper, told TIME on Sunday, adding that Algerians had been gripped by the news from Egypt playing on satellite networks all week. “In both countries, the army arrested a political process involving Islamists.”

The history of the two desert countries along North Africa’s Mediterranean coast has many differences, of course. Algerians fought a brutal war against French colonial rule, which ended with independence in 1962. As the victors, the main revolutionary movement — the National Liberation Front or FLN — has dominated political power ever since. Egypt emerged from underneath Britain’s suzerainty decades earlier and by the 1950s was in the midst of its own revolution, having deposed the country’s King and installed one of the coup leaders, the populist military man Gamal Abdel Nasser, as President.

(MORE: The Muslim Brotherhood’s Outrage: Protests and Gunfire Follow Morsi’s Ousting)

Yet for all the divergences, Algeria’s more recent conflict offers some chilling parallels, and began when the Algerian constitution was amended to allow political parties other than the FLN to contest elections — not unlike the tumultuous political scramble that has played out in Egypt during the past two years. In December 1991, an Algerian political party called the Islamic Salvation Front, or FIS, which had formed just two years earlier with a platform based on the Muslim faith, swept the first round of parliamentary elections and looked certain to clinch an all-out majority in the second round weeks later. The second vote never took place, however. In between, Algeria’s generals stepped in, dissolved Parliament and banned the popular FIS — and as Egyptian security forces gun down Muslim Brotherhood supporters and occupy the headquarters of the Freedom and Justice Party, the Muslim Brotherhood’s political party, there are real causes for concern.

That move in 1992 sparked eight years of brutal civil war in Algeria. With Islamic politics banned, a militant insurgency quickly formed, led by the Armed Islamic Group — the forerunner to today’s al-Qaeda in the Islamic Maghreb, whose affiliated militias seized a huge swath of neighboring Mali last year. About 200,000 Algerians are believed to have been killed in the 1990s war, many of them in horrific massacres, as the Islamist groups split into different factions, some intensely militant, with killings both among themselves and against the military; foreigners were also targets for assassination, and as Westerners fled en masse, Algeria’s economy plummeted. The exhausted foes finally called a truce in 1999 under President Abdelaziz Bouteflika, who still rules Algeria.

Traveling in Algeria earlier this year, I met many who said the country had never recovered from the trauma of what they called the “dark years” — and that people had little appetite to join the ranks of the Arab Spring like their fellow North Africans in Tunisia and Egypt, since they feared another civil war and were all too aware of the military’s ability to dominate the political process. “There is a feeling of resignation within the population,” Mostefa Bouchachi, an opposition member of Parliament, told me in Algiers in January. “It was easy for Egyptians to go into the streets [during the 2011 revolution] and say, ‘Mubarak get out!’” Bouchachi said. “If you did that here, they would bring 20 other Bouteflikas.”

(PHOTOS: Egyptians Protest the Rule of Morsi, Celebrate Ouster)

Watching events in Egypt from afar this past week, Algerians have been bitterly divided over the military’s actions, seeing in them echoes of their own experience. One possible echo is that Egypt’s military said it was answering the massive appeal for Morsi’s removal, organized in part by the new Tamarod movement, a huge grassroots campaign that gathered some 2 million signatures to demand the President’s ouster. That, says Metaoui, the newspaper columnist, is similar to the Algerian committee of officials in 1992 that called on the military to “save the Republic,” by banning the Islamist FIS party.

If there are lessons to be learned from Algeria, Metaoui says, it is that both sides need to step back and refrain from escalating the bitterness — something Algerians failed to do. “Part of the FIS militants took up arms to defend what they called ‘the people’s choice,’” he says. “Algeria recorded heavy human and economic losses.”

Even the Algerian veterans of that 1990s war were prompted to offer some words of wisdom to Egyptians this week. “The Muslim Brotherhood must use a peaceful way to respond to the military coup against Egyptian President Mohamed Morsi,” Madani Mezrag, the former leader of the now disbanded Islamic Salvation Army, the armed wing of the FIS, who negotiated an amnesty from prosecution under a cease-fire agreement, told the Algerian new site Echorouk on Friday. “They must not allow anyone to get Egypt involved in a civil war.” A look at the region’s war-torn history offers a good reason to back up that argument.

MORE: Egypt: Should We Cheer the People or Weep for Democracy?