JAKARTA (Reuters) - Indonesian police fired water cannon and rubber bullets at protesters setting fires and trying to breach barbed wire barricades on Wednesday as demonstrations over the outcome of the presidential election hit the capital for a second night.

The riots followed an announcement on Tuesday by the General Election Commission (KPU) confirming that President Joko Widodo had beaten his challenger, former general Prabowo Subianto, in the April 17 poll.

Widodo won more than 85 million votes of 154 million cast, but retired general Prabowo has alleged “massive cheating and irregularities” and refused to concede defeat.

The election supervisory agency dismissed claims of systematic cheating, citing a lack of evidence. Independent observers have said the poll was free and fair.

Protesters gathered outside the election supervisory agency in central Jakarta. Some arriving carried wooden poles and some had smeared toothpaste around their eyes, a practice commonly carried out to eliminate the effects of tear gas.

Many left peacefully but as night fell others hurled firecrackers and other objects at officers and set blazes as they tried to breach the barbed wire separating them from police.

Police responded with rounds of tear gas, rubber bullets and water cannon.

Medics were seen treating dozens of protesters affected by tear gas and using oxygen to revive some who had passed out.

On Tuesday, the Tanah Abang area had also seen protests turn violent after nightfall. Jakarta Governor Anies Baswedan said by Wednesday morning six people had been killed and 200 wounded.

Widodo warned of tough action against those instigating riots.

“I will not tolerate anyone disrupting the security ... or those who disrupt the democratic process or the unity of the country,” he told a briefing at the presidential palace.

Chief security minister Wiranto said the government would temporarily block certain social media functions to prevent inflammatory hoaxes and fake news.

Indonesian authorities say 40,000 police and army personnel are on duty across Jakarta to maintain security. Many office buildings, businesses and embassies in downtown Jakarta were closed, as were train stations in the area.

“WE KNOW WHO IS BEHIND THIS”

Police said at three locations in the capital 257 suspects had been detained who were suspected of starting riots.

Prabowo called for peaceful protests and restraint.

“I urge all sides, the people who are expressing their aspirations, the police, the military and all sides to refrain from physical abuse,” he told a briefing.

Slideshow ( 34 images )

Many of the protesters appeared to have come from outside Jakarta and police found envelopes containing money on some of the people they searched, national police spokesman Muhamad Iqbal told a news conference.

“This is not a spontaneous incident, this is something by design. There are indications that the mobs are paid and bent on causing chaos,” he said.

Later at a news conference, police displayed suspects in orange jumpsuits as well as petrol bombs, makeshift arrows, sickles and cash in envelopes.

The KPU on Tuesday confirmed unofficial counts by private pollsters that gave Widodo a 55.5% share of votes against 44.5% for Prabowo.

Slideshow ( 34 images )

A Prabowo campaign official said they planned to contest the result in the Constitutional Court on Thursday. Prabowo also launched a legal challenge after he was defeated in the 2014 election by Widodo, which was unsuccessful.

Analysts have said Widodo’s double-digit margin of victory means the opposition does not have a strong case to claim rigging, but Islamist supporters of Prabowo could cause considerable disruption.

Islamist groups, many of which support Prabowo, have in the past been able to mobilize mass support.

From late 2016, they organized a series of protests against then-Jakarta governor Basuki Tjahaja Purnama, the first ethnic-Chinese Christian to hold the job, who was subsequently jailed for insulting the Koran.

Presidential Chief of Staff Moeldoko said he believed there was “a systematic effort by a certain group ... that is riding on the situation to muddy the situation”.

“We know who is behind this,” he said.

Of the six reported fatalities, a 30-year-old man was killed due to a blunt force trauma, said Dr. Sumariyono at the Cipto Mangunkusumo hospital in Jakarta. Another man died of bullet wounds, news website Tirto.com reported, quoting a doctor at another hospital.

National police chief Tito Karnavian said reports of the deaths were being investigated. Police spokesman Dedi Prasetyo said security forces, including military personnel, were not armed with live bullets.