Lawyers and activists said that sexual minorities have been harassed in the past, but that the latest raids were without recent precedent.
Speaking to the local APA news agency on Tuesday, Ekhsan Zakhidov, a spokesman for the Azeri Interior Ministry, said the raids were “justified.”
“People, infected with AIDS and other sexually transmitted diseases pose a threat to lives and health of young people, who get in contact with them,” said Mr. Zakhidov, claiming that 16 of those arrested had AIDS or syphilis.
This claim could not be independently confirmed.
The crackdown elicited comparisons to tactics seen in the Chechnya region of Russia, where dozens of gay men were detained, and in some cases tortured and some killed, in a crackdown in April.
In Azerbaijan, Mr. Rahimli, the lawyer, and other advocates said their clients were afraid to be named publicly, to file complaints against the police or to discuss their experiences, in some cases because their families did not know about their sexuality.
The Nefes LGBT Azerbaijan Alliance, an advocacy group for lesbian, gay, bisexual and transgender people, published an account online by one man, identified only as Hasan.
“They were beating me,” the statement said. “The police told me that I am doing prostitution and must give them information about clients.” In the statement, Hasan said he was not a prostitute.
Homosexuality was decriminalized in Azerbaijan, a mostly Muslim former Soviet republic in Central Asia, in 2000, but discrimination and even violence remain problems.
Many of those arrested were sentenced to up to 30 days in jail, after being charged with disobeying police orders, said Javid Nabiyev, a local activist who is helping lawyers appeal the sentences.
Many were detained at home or at work, exposing their sexual orientation to their families and colleagues, said Mr. Rahimli, one of the lawyers.
An activist and staff member of Minority, a magazine in Azerbaijan that covers gay and transgender issues, who spoke on the condition of anonymity for fear of reprisal from the government, said many victims had been forced by the police to provide names of their friends and colleagues.
Some victims were detained after being lured to meet in the city by the police, who were posing online as gay or transgender people looking for dates, the activist added.
Many of those affected lived in rented apartments, which their landlords told them to vacate after the raids, the activist said. Some fled for Turkey or went to hide in other regions of Azerbaijan.