The story of the Virginia police detective who led a contentious teen sexting investigation last year has unraveled in a spectacularly depressing way. The detective, 39-year-old David E. Abbott Jr. of the Manassas Police Department, shot and killed himself yesterday as police attempted to arrest him for child molestation.

Abbott made headlines last year for attempting to procure a photo of a teen boy’s genitalia in order to “prove” that the teen sexted his girlfriend. The investigation was controversial from the start—prosecutors were trying to bust the teen for distributing “child pornography” by sexting his girlfriend—but it became even more tortured once Abbott and the prosecutors obtained a search warrant to take a photo of the accused teen’s erect penis. Comparing that photo to the sexts the teen allegedly sent would, Abbott and the prosecutors reasoned, prove their case.

The police and prosecutors eventually withdrew the request after heavy criticism from the teen’s attorney and the press. According to The Washington Post, Abbott then sued the teen’s attorney for defamation, but ended up dropping the case last month. In August, civil rights lawyer Victor Glasberg notified Abbott, the police department, and prosecutors that he planned to file a federal lawsuit on behalf of the teen’s family over the department and prosecutors’ handling of the case.

Before and throughout this ordeal, Abbott was allegedly sending inappropriate text messages to two different 13-year-old boys. He met the victims while coaching youth hockey in the area, the Post reports:

Police said they learned [on Monday] that Abbott had sent inappropriate text messages and emails to a 13-year-old boy he met through the hockey program. By phone and social media, Abbott had been asking the boy for sex acts for more than two years, county police said.

Detectives then learned of a second potential victim, a boy who was 13 and was also part of the Patriots hockey club in 2008 when Abbott began sending him inappropriate messages, police said.

Early on Tuesday morning, police obtained a search warrant and four felony arrest warrants for Abbott, including “two counts of indecent liberties by a custodian and two counts of use of a communication device to solicit a sexual offense.” Police arrived at Abbott’s house at about 2:30 a.m. Tuesday, and Abbott refused to surrender. There was a four-hour standoff, per the Post, but Abbott did eventually come out of the house to speak to police. At 7 a.m., he shot himself.

In a statement to CBS DC, the Manassas Police Department said Abbott had been an officer for 14 years. He served on the Northern Virginia-Washington D.C. Internet Crimes Against Children Task Force.