An elite police unit detained the men early Friday in a raid on a community center at Keraniganj, south of the nation's capital, Dhaka.

"We've arrested 27 people for homosexuality. They are homosexuals. They held a get-together there," an official with the unit told the AFP news agency.

Authorities said the suspects were mostly students aged in their 20s and had traveled from across the country. They were allegedly found with drugs and condoms in their possession.

Police said the 27 may not face charges of homosexuality, which is punishable with life in prison, because they were taken into custody before engaging in sexual activity. But they could still be charged with drug offenses.

Watch video 01:17 Q&A: Life as an LGBT in Bangladesh

Homosexuality is illegal in Bangladesh under a rarely-enforced British colonial era law, and the country's lesbian, gay, bisexual and transgender (LGBT) community is often targeted by discrimination and rights abuses.

Last year, suspected Islamist militants killed activist Xulhaz Mannan and his friend in Dhaka. The 35-year-old, a USAID official, had founded the country's only LGBT magazine Roopbaan and was a leading campaigner in the local gay community.

nm/sms (AP, AFP)