Five men in San Jose, California, have filed a federal lawsuit saying that their Fourth and Fourteenth Amendment rights were violated by an undercover gay sex sting.

The men were arrested in 2014 and 2015 in a 17-month operation at a park known to be a place where gay and bisexual men often meet. They were not accused of having sex in public, only of loitering with the intent to commit a lewd act, and one of them even said that he was arrested after he rejected the decoy officer.

The charges against the men were dismissed last year, but now they are seeking damages of $1 million for the arrests. They are also seeking class-action status for the lawsuit and are trying to end “capture the fag” operations throughout the country.

“They’re invalid and discriminatory because they target male-male public sex and not also male-female public sex,” their lawyer Bruce Nickerson said.

Nineteen men were arrested in the undercover operation, which was suspended two years ago when six of the men fought to have the charges against them dismissed. Charges were dismissed against one other man for insufficient evidence, while the rest of the defendants accepted a plea deal with prosecutors.

The six who fought the charges argued that they were approached by an undercover officer who made lewd requests to them, and then arrested them if they responded. Their lawyer said that police did not respond similarly to heterosexual public sex or public discussions about sex.

The police said that they were only responding to citizens’ complaints, but they could only show one such complaint. Other complaints about drugs, prostitution, and firearms in that park did not receive as much attention as that one complaint about gay cruising.

The judge dismissed the charges, saying that the police had targeted gay and bisexual men. “Unpopular groups have too often been made to bear the brunt of discriminatory prosecution or selective enforcement,” he wrote in his ruling.

Now five of those six men are suing the city, but San Jose police say that things have changed.

“We have not used these type of undercover operations in response to public complaints of unlawful lewd-conduct in the more than two years since these arrests occurred,” San Jose Police Chief Eddie Garcia said in a statement. “We are still responding and enforcing the law by utilizing other techniques.”

“We created an LGBT advisory committee, established an LGBT liaison officer program and launched a first-in-the-nation police recruiting campaign featuring same-sex couples.”

Nickerson has had success in other cases in southern California. In Long Beach, a judge dismissed charges against a man caught in a gay sex sting. “The presence and tactics of the decoy officers actually caused the crimes to occur,” the judge wrote in his ruling.

“The guys that this catches are those who are half in and half out, the most vulnerable. For them this is the only way to explore their sexuality,” Nickerson said. “If they were completely out, they would go to a gay bar. Because they have this need, they go to quasi-public places, and use signals to avoid offending members of the public.”

“Capture the fag” stings are less common than they were in the past, but they can still have horrible impacts on people’s lives. Those arrested often have to register as sex offenders for life, lose jobs, and are outed to their communities against their will. Sometimes the people arrested commit suicide after their names, addresses, and mugshots are published in local media.