Image copyright Getty Images Image caption This teenager was sentenced to public flogging for spending time with a man who was not her boyfriend

More than 500 people have been publicly flogged in Indonesia in the past two years, a rights group says.

Human Rights Watch called on the country's president to end the "barbaric" punishment.

Aceh province is the only part of Indonesia that practices Sharia law.

This was permitted as part of a peace deal with separatists in 2006, but the law has become increasingly conservative, particularly regarding gay and extra-marital sex.

Sharia police were set up to patrol streets.

In October 2015 a new Islamic criminal code known as Qanun Jinayat came into effect in the province, stating that same-sex relations should be punished by up to 100 lashes, and sex outside marriage by up to 30 lashes.

Human Rights Watch warns that these laws, plus those that prohibit gambling and drinking alcohol, have been extended to cover non-Muslims as well as Muslims. Last year a Christian woman was caned for selling alcohol.

Other countries where caning and flogging are used as punishments include Iran, Sudan, Saudi Arabia, the Maldives, Malaysia, Singapore and Brunei.

The campaign group Amnesty International says it could be considered akin to torture.