Jakarta (AFP) - Indonesian Budi Ahmad used to live openly as a gay man without fear of becoming a target for violence in the world's biggest Muslim-majority nation. Not any more.

The country of 260 million is in the grip of a moral panic, with critics saying the vulnerable LGBT minority is being used as a political punching bag in the run-up to 2019 elections.

Hardline rhetoric and a string of arrests have raised fears among the community.

"There could be more persecution and we're scared that the public might become vigilantes," said Ahmad, who agreed to speak to AFP using a pseudonym.

The 29-year-old, from a small town in the province of West Sumatra, said family and friends in the tight-knit area have long been aware of his sexual orientation.

But he said the public mood was turning increasingly ugly and he was now confronted with deepening hostility.

"People look at me wherever I go these days. Some avoid me," said Ahmad of his non-traditional masculine image.

"Now when I go to withdraw money from the ATM, for example, there are people staring at me. It never used to be this bad."

Indonesia's LGBT community has always been vilified as immoral.

But the recent police crackdown -- including authorities hosing down a group of transgender women in what they called a "mandatory bath" -- comes against the backdrop of a recent lurch toward religious conservatism.

The shift, led by increasingly powerful hardliners, has dented Indonesia's reputation for moderate Islam.

Last week, thousands of anti-LGBT demonstrators marched outside the capital Jakarta, as some local politicians called for carte blanche to detain and "rehabilitate" members of the minority.

Several mosques in West Java were recently urged by the local government to conduct sermons on the dangers of homosexuality.

And Indonesia's biggest Muslim organisation -- the 80-million-member Nahdlatul Ulama -- has called for a clampdown on same-sex relations.

- 'Cynical political gain' -

Concerns have been aggravated by president Joko Widodo selecting a conservative cleric, known for his disparaging views of the gay community and other minorities, as his running mate for next year's elections.

A poll this year showed nearly 90 percent of Indonesians felt "threatened" by the LGBT community, while a 2013 Pew survey said 72 percent of Indonesian Muslims supported replacing the secular code with Islamic law, which bans gay sex.

"(The elections) could mean an uptick in politicians scapegoating... people for cynical political gain," said Human Rights Watch researcher Kyle Knight.

"The verbal threats politicians issue can quickly metastasise into physical attacks."

Police arrested at least 300 suspected LGBT people last year -- a record -- mostly under an anti-pornography law as homosexuality and gay sex are legal in Indonesia.

This month, 10 people described as "suspected lesbians" were arrested in West Sumatra, following the detention of another eight lesbians and transgender people in October.

"This situation is alarming as the hateful abuses by law enforcement bodies... are seen as a normal practice by many people," said Usman Hamid, Amnesty International Indonesia's Executive Director.

- 'Eradicate LGBT' -

Officials are unfazed by the criticism.

"We're being consistent in our efforts to eradicate LGBT (behaviour) because it's very destructive," said West Sumatra deputy governor Nasrul Abit, adding that thousands of people were having "deviant sex" in the region.

Parliament is considering a move to criminalise sex outside marriage -- including gay couples -- while the health ministry previously announced plans to release a medical guide classifying homosexuality as a mental disorder.

The UN human rights chief and Association of Southeast Asian Nations (ASEAN) have criticised the proposed legal overhaul.

Authorities have also taken aim at social media, arresting two men for links to a LGBT community Facebook page.

Google in January pulled one of the world's largest gay dating apps from the Indonesian version of its online store in response to government demands.

- 'This is wrong' -

The latest crackdown can be traced back to 2016 when Indonesia's higher education minister Mohamad Nasir called for LGBT student groups to be banned from universities, and the defence minister criticised gay and trans rights activism, Human Rights Watch said.

Since then, police have raided nightclubs, saunas, hair salons, hotels and even private homes in pursuit of LGBT people.

Gay people have been publicly flogged in Aceh under the province's Islamic legal code.

Local police there made global headlines when they arrested a dozen transgender people and publicly humiliated them by chopping off their long hair and forcing them to wear men's clothes.

But there are few hopes that Widodo or other senior officials vying for re-election will protect a widely hated minority, said HRW researcher Andreas Harsono.

"We need leaders who have the courage to say this is wrong."