The United Nations human rights office says Indonesia unjustly arrested dozens of people during an anti-gay crackdown last week at a sauna in Jakarta.

More than 50 people were arrested in the police operation, while four men and one woman were charged under the country's pornography law, a vague statute used to arrest people for consensual same-sex relations.

More than 100 men were arrested under the same law following a police raid at a Jakarta gay club in May.

"Arresting or detaining people based on their actual or perceived sexual orientation or gender identity is by definition arbitrary and violates international law," UN human rights spokesperson Rupert Colville told a news briefing.

Mr Colville also criticised similar crackdowns against LGBT people in Egypt and Azerbaijan.

More than 50 people have been arrested so far in Egypt's widest anti-gay crackdown, a swift zero-tolerance response to a rare show of public support for LGBT rights in the conservative Muslim country.

Two people were arrested for waving rainbow flags at a concert in Cairo and one for a Facebook page.

Loading...

At least 10 men in Egypt have been sentenced to between one and six years imprisonment, while most others await trial and a few have been released.

"In some cases, individuals were reportedly arrested after being entrapped by law enforcement officials on apps and in internet chat rooms," Mr Colville said.

In Azerbaijan, more than 80 lesbian, gay, bisexual or transgender people have been arrested since mid-September.

The UN has received allegations that some were subjected to electric shocks, beatings, forced shaving and other forms of humiliation to force them to incriminate themselves before being released, Mr Colville said.

There was no immediate comment from authorities in the capital Baku.

"In all three countries, authorities have alleged that those arrested were involved in sex work," Mr Colville said.

"In almost all cases the accused have denied such allegations or indicated that they were coerced into confessing involvement."

He called for the release of people detained on the basis of sexual orientation or gender identity and for authorities to drop charges based on vague or discriminatory laws, and to repeal such legislation.

Reuters