Image copyright AFP Image caption Protesters burned tyres outside parliament as MPs debated the bill

The Indonesian parliament has scrapped direct elections for regional governors and mayors in a move widely seen as a blow to President-elect Joko Widodo.

Mr Widodo, himself a directly-elected governor, called the vote a "big step back" for democracy.

The system was introduced in 2005 in a bid to allow new politicians to emerge, not linked to the old political elite.

But its opponents argue direct elections are too costly and have in many cases led to corruption.

Mr Widodo's opponents have a majority in the national parliament.

The bill was passed early on Friday after a heated debate that lasted for more than 10 hours.

Pro-democracy activists demonstrated against the bill by burning tyres outside parliament in Jakarta.

Image copyright AFP Image caption Joko Widodo was himself a directly elected mayor and governor

The bill stipulates that mayors, provincial governors and district heads will now be chosen by local parliaments, as they were prior to 2005.

The president will continue to be directly elected.

Ahead of the vote, Mr Widodo - who is known as Jokowi - said: "Directly elected leaders have a moral obligation to the people. They have to look after the people, because they were chosen by the people."

Angry reaction

Mr Widodo, who won the presidency in July, entered politics by being directly elected as a local mayor. He then went on to run for the position of Jakarta's governor, winning a resounding victory in 2012.

His election as president was seen as heralding a new era for Indonesia, where leaders have generally been drawn from the military and political elite.

The BBC's Indonesia editor Karishma Vaswani said that Indonesians reacted angrily on social media.

"Rest in Peace democracy" became a trending topic on Twitter, and many commented that the decision was a huge setback for Indonesia's nascent democracy, says our correspondent.

Some say the decision takes the country back to the era of former dictator Suharto. Experts have said that under his 32-year regime, local parliaments engendered nepotism and cronyism.