Every year at this time Indonesia renews its collective distain for communists, widely blamed for allegedly trying to tear the country apart in an aborted coup more than half a century ago. But this year is different.

As thousands of police stood guard outside government buildings and the parliament, Islamic conservatives seized on the annual rite to get back at the administration of President Joko Widodo, which for months have been squeezing hardliners following a successful overthrow of Widodo’s protégé in Jakarta’s elections earlier this year.

Outraged and emboldened, analysts claim, Islamists and their allies among Jakarta’s elite are betting this year the spectre of a resurgent red menace will have extra resonance as they work to defeat Widodo in elections 18 months away.

“It’s the Jakarta election play book all over again,” said Andrew Mantong, a researcher at the Centre for Strategic Studies (CSIS) in Jakarta. “These are contentious politics played out by Islamists and elites seeking power. They are trying to find what repertoire might produce a robust coalition.”

Television footage showed hundreds of police standing inside the gates of parliament backed up by rows of armoured personnel carriers as protesters gathered after Friday prayers. Organisers expected at least 50,000 people and police said roughly 20,000 officers were ready to guard the site.

The rally followed efforts by the administration to squeeze Indonesia’s small but vocal Islamic groups.

In July, the government banned the far-right Hizmut Tahrir (HTI), which seeks an Islamic caliphate in place of the government. The rally’s organisers, the Islamic Defender’s Front (FPI), seeks government in accordance with sharia law. But FPI leader Rizieq Shihab is in hiding in Saudi Arabia and wanted by the police for allegedly violating the country’s pornography laws for sending lewd text messages to a woman who is not his wife.

Inverted flags, illegal migrants: how Malaysia-Indonesia ties took a turn for the worse

Earlier this year, far-right Islamic groups, including the FPI and the HTI, helped organise mass rallies that contributed to the defeat of Widodo’s protégé, Basuki Tjahaha Purnama, in April’s gubernatorial elections. Anies Baswedan, a former minister in Widodo’s cabinet, won by a landslide after appearing at FPI’s headquarters to appeal for their support. Purnama was later jailed for violating the country’s blasphemy laws on what many consider trumped-up charges.

The rally was held on the eve of the 52nd anniversary of the murder of six army generals by suspected communists. The attack triggered a massacre of an estimated 500,000 alleged sympathisers and the jailing of many more, in some cases for membership of a labour union or for being ethnic Chinese.

There is little evidence of a revival of the communist party, not least because of its enduring unpopularity. Communism is equated to godlessness – anathema in deeply religious Indonesia.

In mid-September, crowds thought to be organised by the FPI laid siege to a human rights NGO offering free legal help in Jakarta because they suspected the group of harbouring communists. It wasn’t.

Widodo, a self-made millionaire from his successful furniture exporting business, was very nearly undone by allegations of communist sympathies during the 2014 election.

The head of the country’s military, General Gatot Nurmantyo, has reportedly ordered military officers to screen a propaganda film, once used in schools during the Suharto era, that recounts the alleged coup and the murder of the army generals.

A staunch nationalist, Nurmantyo earlier this year severed military ties with Australia when he learnt of the existence of a poster at a commando base mocking Indonesia’s founding ideology, known as Pancasila.

Nurmantyo is widely considered to hold ambitions for high office and has made hay while in his position, aiming to win the nomination next September as a vice-presidential running mate popular with conservatives, said Philips Vermonte, also of CSIS. “After he retires his political capital evaporates quickly,” Vermonte said.

Would moving Indonesia’s capital work?

However, Widodo remains popular and his likely opponent, Prabowo Subianto, who contested the election in 2014 and was a three-star general, may not need his hardline credentials.

A survey conducted by the CSIS said 68 per cent of the 1,000 respondents approved of Widodo’s performance since he assumed office in 2014. Since then, he has removed fuel subsidies, kick-started infrastructure projects and presided over a relatively clean government.

But Widodo, also known as Jokowi, risks haemorrhaging support if controversy diverts attention.

“It worries me that this has come up again,” Mantong said. “Jokowi remains popular but I’m afraid Indonesia risks following the regional trend where elites connect with crowds by pushing away logic and valid argument.”

That trend may already be manifesting in Indonesia, where opinion polls suggested residents were largely satisfied with Purnama, also known Ahok.

Accusations that he slandered the Koran while campaigning overshadowed his success in building infrastructure, rooting out corruption and distributing much-needed services to the poor. His ethnicity and religion – he was a Christian of Chinese descent – made it easier for Islamic conservatives to dissuade the faithful from supporting him at April’s gubernatorial elections, said Tsamara Amany, a likely candidate for parliament in the 2019 elections.

Amany opposed deputy parliamentary speaker Fahri Hamzah’s efforts to shut down Indonesia’s corruption watchdog, the KPK, in a television debate in July which has since attracted a million views on YouTube.

“Jakartans are not intolerant. The Ibu-Ibus were satisfied. They were just afraid of going to hell if they supported Ahok,” said Amany, using the term used for buttoned-down family matriarchs.

“The real threat to us is radicalism, not communists. I feel sorry that Jokowi has to focus on this because he has bigger issue such as poverty and education.”

The threat seems likely to grow. The HTI are fighting their ban at the Constitutional Court on the basis that it infringes on their human rights because it limits their right of assembly and free speech, says Kapitra Ampera, a lawyer for the FPI who is arguing the case at the constitutional court.

“This violates the basic rights of people to organise and express themselves,” Ampera says.

Ironically, Ampera does not think the same consideration ought to be extended to communists.

“The Communist Party is outlawed under Indonesian law. The government can not allow the Communist Party to rise up again.”

Andreas Harsono of Human Rights Watch says the court’s conservative bent suggests the HTI may win their case.

“The HTI are using the red scare to build better ties with elites,” Harsono says.

Vermonte said the red scare will only intensify as parties prepare to nominate their candidates for the presidency next year.

“You can expect this to come around next year and it’s going to be worse,” he said.