JAKARTA (Reuters) - Indonesian police on Friday said they had detained eight people before dawn, thwarting a plot hatched to take advantage of a demonstration by tens of thousands of Muslims and lead an uprising against President Joko Widodo’s government.

The detentions followed weeks of tension, during which Widodo said “political actors” had fanned violence at a Nov. 4 protest and the country’s police chief warned that “certain groups” might try to occupy parliament during Friday’s rally.

The group had been under surveillance for at least three weeks, and the move against it came hours before the start of a rally in central Jakarta to protest against the city’s governor, a Christian accused of insulting the Koran.

Police spokesman Boy Rafli Amar described the plan as attempted subversion of Widodo’s government, which has strong support from the military.

“The suspicion is that among other things there was a link to plans to attempt subversion, and to take advantage of conditions today,” Amar said.

“They had another agenda aside from prayers.”

A sea of white-clad protesters surged around Jakarta’s National Monument on Friday morning. Police estimated their number at about 150,000, many having come from towns and cities across the island of Java.

They chanted and carried banners demanding that the city’s governor, Basuki Tjahaja Purnama, be jailed.

Purnama is being investigated over comments about his opponents’ use of the Koran during political campaigning. He denies wrongdoing, but has apologised for the remarks.

Slideshow ( 10 images )

Police on Thursday handed a dossier on their investigation of his comments to prosecutors, who are expected to take the case of alleged blasphemy to court in coming weeks.

Purnama, a long-time ally of Widodo, is running for re-election in February against two Muslim candidates.

POLITICAL TENSION HIGH

The contest for the governorship has sent political tension soaring, with rumours of plots to undermine Widodo and scupper his chances of winning a second term in 2019.

Police spokesman Rikwanto said altogether 10 people were detained between 3 a.m. and 6 a.m. Eight were being investigated under the conspiracy and treason provisions of the criminal code, and the other two for hate speech.

“They are being accused of subversion,” said Yusril Ihza Mahendra, a lawyer for two of the eight.

He said the group included Rachmawati Sukarnoputri, a politician and sister of former president Megawati Sukarnoputri. Their father was independent Indonesia’s first president.

The group also included rock musician Ahmad Dhani and retired army general Kivlan Zen, who had both supported one of Widodo’s rivals for the presidency in 2014, the lawyer said. Dhani faced public criticism in 2014, when he appeared wearing a German Nazi-like uniform in a music video while campaigning for his candidate.

Slideshow ( 10 images )

Rachmawati and Dhani had called on Thursday for protesters to march towards parliament, media reported.

“These are people who are known to have grudges against anyone in government,” said Jakarta-based political analyst Wimar Witoelar. “These are small, insignificant people, but it’s a big crowd and a small spark could start up a large fire.”

Widodo addressed the rally after Friday prayers and praised what had been a peaceful protest. Then, under rainy skies, the crowd started to disperse, with some chanting directed against Purnama.

Purnama is popular with many for pushing through tough reforms to modernise a capital congested with traffic.

But opinion polls have shown him slipping into second place in the race for re-election as governor, a position Widodo himself used as a stepping-stone to the presidency.

Leading the field now is Agus Yudhoyono, the 38-year-old Harvard-educated son of Widodo’s immediate predecessor, Susilo Bambang Yudhoyono.