Sitting in cars along the edge of the park, four Long Beach police officers waited for the right time to pounce.
The innocuous signal that spurred them to action came when they saw a middle-aged man close his laptop and head toward a public restroom known in the area as a place where men have sex with each other. One of the undercover officers followed him inside.
Within moments, police were leading the man away in handcuffs. His crime: exposing himself to the officer.
The 2014 arrest in Recreation Park marked another successful sting for the city's vice squad. But the undercover operation, which was sharply criticized recently by a judge, also exemplifies a controversial, age-old police tactic that many of California's largest law enforcement agencies have quietly abandoned in recent years amid mounting criticism and changing sexual attitudes.
In Los Angeles, Long Beach and other areas where undercover lewd conduct stings endure, police defend them as an important tool for catching people who are violating the law and for deterring others from trying to have sex in parks and other public areas used by families and children.
Gay-rights activists do not condone public sex but have long condemned the busts as a form of entrapment, saying they unfairly single out gay men, with sometimes devastating consequences. The issue has been debated for decades. But in recent years, critics of the stings have gained traction as public attitudes about homosexuality and gay rights have shifted.
Undercover officers, critics contend, often exchange flirtatious signals and make arrests of men who think their advances are welcome, when no one else is nearby to be offended. They say that the stings can ensnare men who hadn't otherwise been seeking sex and that they rarely, if ever, target straight people.
Under state law, people who are convicted of indecent exposure must register as sex offenders and face possible jail time. Some have lost their jobs or committed suicide.
"Nobody is going to defend lewd conduct, but there is a qualitative difference between sexual predators and people who engage in boorish behavior," said Los Angeles County Assessor Jeffrey Prang, who is gay and a former special assistant in the Sheriff's Department who worked with its LGBT advisory council. "Criminalizing them isn't really justice. You just want them to stop."
Courts also have raised questions about the stings, invalidating a number of prosecutions in various parts of the state. In some cases, judges found no crime had occurred because the undercover officer conveyed sexual interest to the target and no one else was present to be offended by the lewd conduct. Last month, a Los Angeles County judge threw out the charges in one case stemming from Long Beach's 2014 operation, saying police were discriminating against gay men.
Many law enforcement agencies have stopped in response to lawsuits or after political backlash. The Times contacted police officials in San Jose, Anaheim, Glendale, San Francisco, Bakersfield, Beverly Hills and Laguna Beach, among other agencies. Representatives for each said their departments had not used such undercover stings in years.
These officials said they came to view the stings as ineffective or unnecessary after noticing a sharp drop-off in complaints about public sex during an age when men can easily find sexual partners through the Internet and dating apps such as Grindr.
Some cities have found alternative ways to tackle the problem of cruising — the act of searching for anonymous public sex. Departments will now post uniformed officers near cruising hotspots or improve lighting and trim trees and bushes in areas known for public sex.
"Bottom line is, there were much better things that the vice ... bureau should have been engaged in, namely sex trafficking and sexual exploitation," said Los Angeles County Sheriff's Cmdr. Merrill Ladenheim, who heads the agency's human trafficking task force. "We really refocused our efforts on those other crimes where we have a victim."
LAPD officials say they have made a point of carrying out undercover operations less frequently in recent years. In 2007, the agency revamped its lewd conduct policy to tell officers that stings should be used only "as a last resort."
But when alternative tactics fail, the department has no choice but to deploy decoy officers, said Capt. Andy Neiman, the LAPD's chief spokesman. While lewd conduct complaints have dropped dramatically in recent years, Neiman said stings have been used to shut down persistent hotspots for gay cruising and lewd acts 11 times since 2014.
Complaints often come from people concerned about sex acts in public places, namely libraries and residential streets, where children could stumble upon people engaged in a lewd act, Neiman said.
"You still have to enforce the law when you get complaints," he said.
The use of undercover cops to target gay men in Southern California stretches back to the early 20th century, when gay sex was illegal, said Lillian Faderman, a historian and author of "Gay L.A.: A History of Sexual Outlaws, Power Politics, and Lipstick Lesbians."
The pioneers were W.H. Warren and B.C. Brown, "vice specialists" who loitered in public restrooms and other areas while carrying out so-called "purity campaigns" aimed at gay men in Long Beach and Los Angeles, Faderman wrote, adding that their methods served as a model for stings throughout Southern California.
The pair had no prior police training but were given police badges in both cities. They were paid for each arrest and offered their services to other major cities, she said.
In 1914, The Times reported on an operation in which the two helped arrest 31 men accused of engaging in gay sex at private clubs in Long Beach. Long Beach's mayor and police chief awarded Warren and Brown a proclamation that said their work "rid the city of a dangerous class which threatened the morals of the youth of the community."
Soon after the arrests, one of the men, a prominent banker and church officer, committed suicide by ingesting cyanide. The fear that other men would follow suit led the city to temporarily ban the sale of toxic substances, The Times reported.
In more recent decades, police agencies that employed the stings defended them as an effective way of responding to complaints about areas well-known for public hook-ups. Decoy operations are necessary to make arrests, officials said, because the crime of lewd conduct is a misdemeanor that requires officers to witness the conduct to justify an arrest.
"These are public parks, and public parks attract kids and families," said Bakersfield Sgt. Gary Carruesco, whose department stopped conducting stings after a judge found the practice to be discriminatory in 2005. "Obviously, they can walk into a bathroom and witness things."
West Hollywood Councilman John Duran, an attorney who has represented men in cruising cases for 30 years, said a typical client was a "deeply closeted gay or bisexual man who had hidden rendezvous in public places." Many, he said, had low self-esteem and turned to cruising because they thought they were undeserving of intimacy.
But the LGBT movement, said Duran, who is gay, "has produced new generations of out and proud people who believe they can have healthy sexual encounters." Growing public support of gay rights and the presence of openly gay officers in police departments has put pressure on agencies to stop using stings, he said.
Recent decoy operations have drawn fierce criticism.
Palm Springs police sparked outrage in 2009 when officers arrested 19 men in an undercover sting in a neighborhood known for gay resorts. Audio recordings of the operation caught a detective and the police chief making derogatory comments about the men who were arrested. The chief later resigned, and the department has not employed the tactic again, a police spokesman said.
In 2012, Manhattan Beach police were blasted for releasing the mugshots of men swept up in a lewd conduct sting. Police said at the time that local lifeguards had found graffiti of graphic sexual images on restroom walls, and holes drilled through stall partitions.
One man sued the city, alleging that he was falsely arrested and that his photograph and name were released to the media. The department stopped using decoys soon afterward, said Sgt. Paul Ford, supervisor of the agency's detective bureau.
In Long Beach, gay-rights activists said they were troubled — and surprised — to see stings still being deployed in a city with a vibrant LGBT community and an openly gay mayor.
Long Beach police took more than two dozen men into custody during decoy operations from 2012 to 2014, according to Bruce Nickerson, a civil rights attorney.
One of those men was Rory Moroney, who was arrested in the Recreation Park sting in 2014.
On the day he was arrested, Moroney said he was using his laptop in the park to search for jobs. He knew the reputation of the men's room, but he hadn't gone there to cruise, he said. Moroney, 50, said he was washing his hands when he saw a man standing in a stall, thumbs hooked over his belt, smiling and nodding. He believed the undercover officer was flirting.
"They were targeting. That's not right," Moroney said. "They baited me. They trapped me."
On April 29, Los Angeles County Superior Court Judge Halim Dhanidina sided with Moroney and tossed out the charges. The judge noted that the Long Beach police vice unit had conducted a series of stings spanning two years that used only male officers to arrest male suspects seeking sex with other men.
Dhanidina found that the stings were "indicative of animus toward homosexuals." The judge also ruled that "the presence and tactics of the decoy officers actually caused the crimes to occur."
Long Beach police said they conduct decoy operations only in response to public complaints. Cmdr. Paul Lebaron, who oversees the city's detective division, including the vice unit, said the department exhausts other tactics first before using stings as a last resort. Lebaron, who was not running vice operations when Moroney was arrested, said the agency has conducted only one lewd conduct sting since January 2015.
The city prosecutor's office has not said if it will appeal the judge's decision. Nickerson said he plans to argue in court that the charges against the 27 other men caught in the stings in 2013 and 2014 should be invalidated.
Mayor Robert Garcia said he hadn't been aware of the stings and that the city is now reviewing its policies.
"I view Long Beach as a progressive place that believes in justice and dignity for everybody," Garcia said. "So when I hear that something occurs that could be contrary to that, I'm alarmed."