JAKARTA (Reuters) - As the ranks of protesters thickened in central Jakarta on Dec. 2, turning into Indonesia’s biggest mass demonstration since the end of authoritarian rule in 1998, President Joko Widodo grappled with a dilemma: should he join the rally or stay away?

Habib Rizieq, spiritual leader of the hardline Islamic Defenders Front, speaks to the media after giving testimony in an investigation over blasphemy allegations against Jakarta Governor Basuki Tjahaja Purnama, nicknamed "Ahok", at police headquarters in Jakarta, Indonesia November 23, 2016. REUTERS/Iqro Rinaldi

Recounting what happened behind the scenes that day, two senior officials told Reuters Widodo chose to ignore warnings from security chiefs and went into the crowd, appearing alongside the firebrand leader of a hardline Islamic group.

His move was widely applauded for cooling tensions that had been building for weeks over remarks by Jakarta’s ethnic-Chinese Christian governor that were deemed to be insulting to the Koran.

But critics worry Widodo’s decision may have conferred some legitimacy on a hardline strain of political Islam emerging in the world’s biggest Muslim-majority country, where politics is secular and the majority of believers are moderate, putting social stability at risk.

“Jokowi may have had some tactical gains in the short run,” said Tobias Basuki, an analyst at the Jakarta-based Centre for Strategic and International Studies, referring to the president by his popular name.

“But, for the longer term, Jokowi, his government and the police have been playing a dangerous game. As a result, political Islam has been co-opted by hardliners and progressive Muslims have been sidelined.”

The resurgence of political Islam has been accompanied this year by the reappearance of militant Islamic cells who swear allegiance to Islamic State and have been involved in a series of attacks and foiled plots.

Many of the jihadis were first indoctrinated at mosques that spawned various Islamic vigilante groups similar to the Islamic Defenders Front (FPI), which was at the forefront of the Dec. 2 mass protest in Jakarta, according to counter-terrorism police.

The FPI insists it is neither political nor militant but just wants to uphold Islamic principles.

MOTLEY GROUP OF PLOTTERS

A senior government official, who declined to be named because he was not authorised to speak to the media, said the president had voiced some reservations before joining FPI leader Habib Rizieq on the stage.

Before dawn that day, police rounded up a motley group of figures allegedly plotting to use the rally to launch a popular revolt against Widodo by leading protesters to parliament.

Among those detained was a daughter of independent Indonesia’s first president, Sukarno; a rock star who once appeared in a video wearing a Nazi-style uniform, and a former army general who backed one of Widodo’s rivals for the presidency in 2014.

The official, briefed on discussions between the police chief and one of the president’s most trusted ministers, Luhut Pandjaitan, said Rizieq was on an original list of 20 people suspected of sedition. Police could not confirm such a list.

Rizieq was not detained, however. Instead, he was allowed to lead the protest later that morning.

Minister Pandjaitan told police to arrest the least powerful people on the list of 20 to send a message that the government would not tolerate anybody trying to exploit the tensions, the official said.

Widodo’s office did not respond to requests for comment.

SHARIA LAW

The FPI, which claims around five million members and advocates sharia law across Indonesia’s multi-cultural archipelago, has a history of harrassing minorities. It has forced churches and mosques run by non-Sunni Muslims to close and raids nightclubs and bars it believes foster immorality.

It grabbed the political spotlight by seizing on Jakarta Governor Basuki Tjahaja Purnama’s indelicate remark on the Koran during his re-election campaign, where he is standing against two Muslim candidates. Purnama goes on trial for blasphemy starting on Tuesday in a Jakarta court.

As an ally of the governor, Widodo was the target of some of the outrage from Muslims - at an initial rally on Nov. 4 and then the larger one that brought over 200,000 protesters into the heart of Jakarta a month later.

Ahead of the Nov. 4 rally, Widodo’s security staff persuaded him to leave the presidential palace, said the senior government official. He went to the capital’s airport where, according to his office, he inspected a rail project.

Violence broke out as the demonstration wound up that day.

Another official, at the presidential palace, denied a report that Widodo had gone to the airport as a precaution to flee the country. Underlining his alarm over the situation, however, the president did abruptly call off a visit to Australia the next day.

Widodo was given the same security advice ahead of the Dec. 2 protest, the two officials said. But Pandjaitan urged him to appear at the rally to puncture the mood of animosity.

“He [Widodo] said he did not want to be seen standing ... on the same stage as Habib Rizieq, but Luhut said it was a chance to show real leadership and calm the tensions,” the palace official said.

FALL OF SUHARTO

Rizieq, 51, was not available for comment.

The chief of FPI’s Jakarta chapter, Novel Bamukmin, responding to rumours FPI will form a political party and nominate Rizieq for president in 2019, told Reuters Rizieq had no political ambitions.

“Habib Rizieq’s role has clearly been that of a figure who is pushing togetherness and unity. It is a movement of tolerant Islam,” Bamukmin said.

The movement toward a more conservative and hardline Islam has been developing in Indonesia since the fall in 1998 of strongman Suharto, who had brutally repressed politicised Islam during his three decades in power.

Tim Lindsey, an expert on Indonesian law at the University of Melbourne, said Widodo - perhaps aware of the country’s grim history of popular unrest - had put quelling the masses ahead of squelching the resurgence of political Islam.

“It’s now about ‘mass’ - the easily manipulated masses that are on the streets, a nightmare for any political leader in Indonesia given the events of 1998, when Suharto was toppled,” Lindsey said. “Jokowi now has to crack down because he has let the situation get out of control.”