The teenaged “sexting” case that attracted national attention in 2014 is now enshrined in federal case law.

A police detective who obtained two search warrants to photograph a teenager’s genitalia violated the teen’s Fourth Amendment right not to be unreasonably searched, a federal appeals court has ruled, reviving a lawsuit against the detective that had been thrown out by a lower court. A dissenting judge wrote that the ruling could cause police to be less aggressive in their investigations.

The ruling by the U.S. Court of Appeals for the 4th Circuit continues the nationally renowned case of Trey Sims, who was 17 when police in Manassas, Va., and prosecutors in Prince William County, Va., began investigating him for sending a video of his genitalia to his 15-year-old girlfriend by text message. Manassas City Detective David E. Abbott Jr., the lead investigator, claimed that he was instructed to obtain the warrants by Assistant Commonwealth’s Attorney Claiborne Richardson, and both were sued by Sims in federal court last year.

Richardson is still a prosecutor in Prince William County and currently a candidate for a Virginia circuit court judgeship. Abbott committed suicide in December 2015 as police attempted to arrest him on charges of molesting two young boys. His estate remains a defendant in the suit, while Richardson was dismissed from the suit by U.S. District Court Judge Claude M. Hilton in Alexandria, Va. Sims was not identified in initial stories because he was a juvenile but is being identified now because he is an adult and the plaintiff in the lawsuit.

The case sparked an uproar after The Washington Post reported that Abbott and Richardson had obtained two search warrants, and Abbott already had executed one of the warrants, seeking photos of Sims’s erect penis, to compare with the video sent to his girlfriend. The issue of how to handle “sexting,” particularly between consenting teens, continues to vex authorities, with some saying that it shouldn’t be treated as a crime — Sims was charged in juvenile court with the equivalent of a felony — and others saying full prosecution is needed to discourage it. A Prince William juvenile court judge said there was enough evidence to convict Sims after a trial in August 2014, but eventually dismissed the case after Sims completed a year of probation.

New details of the case emerged in Sims’ lawsuit, though. According to the 4th Circuit opinion, in serving the first search warrant, which sought “a photograph of the suspect’s erect penis,” Abbott ordered Sims to “manipulate his penis” to obtain an erection, with two other, uniformed officers present. That failed, leading Richardson and Abbott to obtain a second search warrant and threaten to take him to a hospital “to give him an erection-producing injection,” the opinion written by Circuit Judge Barbara Milano Keenan noted.

Abbott and Richardson withdrew the second search warrant after a flood of publicity about the case. The Manassas City police issued a statement after The Post’s first story saying that it was “not the policy of the Manassas City Police or the Commonwealth Attorney’s Office to authorize invasive search procedures of suspects in cases of this nature and no such procedures have been conducted in this case.” But when it comes to defining “invasive,” the appeals court disagreed with the police.

“We cannot perceive any circumstance,” Keenan wrote, “that would justify a police search requiring an individual to masturbate in the presence of others.” She noted that the photos Abbott did take were not introduced into evidence, and the juvenile court judge still found sufficient cause to find that Sims possessed child pornography. “Thus, the record demonstrates that there was no evidentiary need to seek a photograph of Sims’ erect penis.”

Richardson and Abbott had argued in district court that they were entitled to qualified immunity because they were simply doing their jobs as law enforcement agents, and Hilton agreed. “Richardson acted within the scope of his prosecutorial duties, and was “protected by absolute immunity.” Sims’s lawyers did not appeal Richardson’s dismissal from the case.

Hilton said Abbott was also immune if his conduct did not “violate clearly established statutory or constitutional rights of which a reasonable person would have known.”  Hilton wrote that “At the time of the incident, it was not ‘clearly established that Detective Abbott would violate [Sims’s] constitutional rights by seeking photographs” of Sims.

The appeals court strongly disagreed, noting that the fact Sims was a juvenile “should have caused a reasonable officer even greater concern in seeking a warrant and in executing the sexually invasive search.” Keenan said that prior case law “would have placed any reasonable officer on notice that such police action was unlawful…Abbott’s conduct affronted the basic protections of the Fourth Amendment, which at its core protects personal privacy and dignity against unjustified intrusion by governmental actors.”

The three-judge panel was not unanimous. Keenan was joined by Judge Albert Diaz, but Judge Robert Bruce King issued a strong dissent. King noted that Abbott obtained and served the warrant only after consulting with his prosecutor and having it approved by a magistrate. “Where a police officer has sought and obtained a search warrant and acted within its scope,” King wrote, “the resulting search is presumptively reasonable…In my view, no reasonable police officer or lawyer would have considered this search warrant, duly issued by the Virginia magistrate, to violate a clearly established constitutional right.”

King said the ruling “could lead law officers to second-guess court orders and avoid judgment calls in gray areas.”

Abbott’s estate is defended in the case by attorney Julia Judkins, who could ask the entire 4th Circuit to rehear the case, seek to appeal it to the U.S. Supreme Court, or simply return to the district court in Alexandria and take it to trial. Judkins said Wednesday she was still reviewing the ruling and hadn’t made a decision on her next move.

Sims, now 20, is represented by Alexandria attorney Vic Glasberg. He said the ruling did not create new law. “It is settled law,” Glasberg said, “that the mere issuance of a warrant by a magistrate — who in Virginia need not even be a lawyer — does not immunize an officer who requests or executes an unreasonable warrant. The issue was: is it unreasonable for police officers to force a minor to take down his pants and manipulate his penis for a photograph. Most people agree it is. This is what the court held, and also that Detective Abbott should have known it.”