The Virginia police officer who wanted to photograph a 17-year-old boy's erect penis in connection to a juvenile sexting case committed suicide Tuesday as authorities went to arrest him on pedophilia-related charges. Those charges were not connected to last year's sexting case that received global media coverage.

Detective David Edward Abbott, a member of the Northern Virginia-Washington DC Internet Crimes Against Children Task Force, last year had obtained a warrant to inject a young boy with a drug that would cause an erection. Abbott wanted to photograph that erection and compare it with photos found on a 15-year-old girl's phone. Amid a public outcry, the Manassas City police eventually decided against doing that . The 17-year-old boy got a year of probation for sexting his teen girlfriend.

Abbott then sued the boy's attorney. He claimed Jessica Foster caused him "severe emotional distress" when The Washington Post reported that "Foster said Detective Abbott told her that after obtaining photos of the teen's erect penis he would use 'special software to compare pictures of this penis to this penis. Who does this? It's just crazy.'"

The story only gets more twisted.

The authorities went to arrest Abbott, 39, on Tuesday. The local Virginia youth hockey coach was facing four charges: two counts of indecent liberties by a custodian and two counts of using a communication device to solicit sexual offenses with a young boy. For at least two years, Abbott had an inappropriate relationship with a boy, now 13, police alleged. He was accused of soliciting sexual acts on the phone, via text messages and social media. Abbott was also accused of having an "inappropriate relationship with a second male victim" affiliated with the Prince William County hockey league.

The Manassas City Police Department, Abbott's employer, lauded the officer, saying in a statement:

This is a tragic and sad day for the Abbott family, the juvenile victims and their families, the Manassas City Police Department, and our community. In spite of these recent developments regarding the serious allegations against him, we are grateful for the contributions Det. Abbott made during his time with Manassas City Police, to include the prosecution and conviction of hundreds of criminals. His family and peers request privacy during this time as we grieve and struggle to accept the realities of such a loss.

When a group of detectives converged Tuesday on the officer's Gainesville, Virginia, home to arrest Abbott, he refused to surrender. Instead, he pulled out a gun and shot himself, police said.