An Egyptian court on Monday ordered the release of 26 men who were detained last month in a raid on a Cairo bath house after police received a tip that they were holding gay orgies.
"The court has ruled that all the accused are innocent," the judge said.
Though homosexuality is not specifically outlawed in Egypt, discrimination is rife. Gay men are frequently arrested and typically accused of debauchery, immorality or blasphemy.
A pro-government television station showed video of police dragging the half-naked men out of the bath house last month. They were subsequently charged with debauchery.
Covering their faces with sweaters or hats, they were marched into the courtroom on Monday, a police officer kicking one and urging them to hurry as they approached a cage used to hold defendants during court sessions.
Highlighting sensitivities in Egypt, a conservative Arab state, people in the court exploded in anger when a journalist took a picture of the men. Someone tried to choke the photographer.
The most recent case to make headlines saw eight men sentenced to three years in jail in November after they appeared in an online video purporting to show the country's first gay marriage ceremony.
The largest crackdown on homosexuals in Egypt took place in 2001, when police raided a floating disco called the Queen Boat. Fifty-two men were tried in the case, which drew widespread criticism from human rights groups and Western governments.