JAKARTA, Indonesia -- Indonesian President Joko Widodo said authorities have the volatile situation in the country's capital under control after six people died Wednesday in riots by supporters of his losing rival in last month's presidential election.

The clashes began Tuesday night when supporters of former Gen. Prabowo Subianto tried to force their way into the downtown offices of the election supervisory agency and continued unabated until ebbing on Wednesday evening. More than two dozen vehicles were burned as rioters took over neighbourhoods in central Jakarta, throwing rocks and Molotov cocktails at police who responded with tear gas, water cannons and rubber bullets.

Flanked by the military chief and other top leaders, a grim-looking Widodo said, "I will work together with anyone to advance this country, but I will not tolerate anyone who disrupts the security, democratic processes and unity of our beloved nation."

Subianto, an ultra-nationalist politician, has refused to accept the official results of the April 17 election and instead declared himself the winner. The Election Commission on Tuesday said Widodo, the first Indonesian president from outside the Jakarta elite, had won 55.5% of the vote, securing the moderate technocrat a second term as leader of the world's most populous Muslim-majority nation.

Subianto, an elite figure from a wealthy family connected to former dictator Suharto, also lost to Widodo in 2014. He has made four unsuccessful bids for the presidency since Suharto was ousted in 1998.

"The bottom line is the people who are protesting and rioting in the past 24 hours represent a small minority of Indonesian voters and a small minority of Indonesian Muslims," said Alexander Arifanto, an Indonesian politics expert at the S. Rajaratnam School of International Studies in Singapore.

"The vast majority of both clearly accepted the election results. By tacitly backing the protesters, Prabowo has lost any remaining legitimacy he had left and clearly shows his true colours as a narcissistic New Order-era relic," Arifanto said, referring to the Suharto era.

Rudiantara, the communications and information technology minister, said social media including Facebook, Twitter and WhatsApp will be restricted on a temporary basis to prevent the spread of hoaxes and inflammatory content. He said messaging systems will still work for text and audio but photos and videos will be blocked or slowed.

National police chief Tito Karnavian said the people who died in the rioting were hit by gunshots or blunt devices. Authorities are still investigating the causes of death and are not ruling out the involvement of third parties acting as provocateurs.

"There are attempts to create martyrs, blaming security officials for building public anger," he said.

The rioting in the capital was planned and not spontaneous and many of those arrested had come from outside Jakarta, according to police. Officers found an ambulance filled with stones, and some of more than 250 people arrested had envelopes containing 250,000-500,000 rupiah ($17-$34), said Jakarta police chief Argo Yuwono. The minimum wage in Jakarta is about $9 a day.

The government had deployed some 50,000 police and soldiers in Jakarta in anticipation of protests following the official election results. Many residents have left the city and parts of the downtown are closed to traffic, with the election supervisory agency and Election Commission barricaded with razor wire.

In the past week, authorities have arrested three pro-Subianto activists on suspicion of treason. They included Sunarko, a retired general and former commander of Indonesia's special forces who uses a single name. Police allege there was a plot to seize crucial government buildings in Jakarta.

Subianto's campaign plans to challenge the election result in the constitutional Court. They allege massive fraud in the world's third-largest democracy but have provided no credible evidence.

The former special forces general and members of his campaign team had said they would mobilize "people power" for days of street protests. Subianto on Wednesday called on supporters and security forces to exercise restraint.

"Like we've said many times before, we support all moral and constitutional means that are peaceful and nonviolent in this political fight for our nation," he said. "And so I plead to all elements of the people exercising their aspirations: the police, the armed forces, and everyone else to refrain from acts of physical harm."

Subianto ran a fear-based election campaign, emphasizing what he sees as Indonesia's weakness and the risk of exploitation by foreign powers or disintegration. He aligned himself with hard-line Muslim groups and won massive majorities in conservative provinces such as Aceh, which follows Islamic Shariah law, but was defeated by Widodo in the president's populous East Java and Central Java strongholds.

Widodo's campaign highlighted his progress in poverty reduction and improving Indonesia's inadequate infrastructure with new ports, toll roads, airports and mass rapid transit.

------

Associated Press journalists Niniek Karmini and Achmad Ibrahim contributed to this report