A teenager who says police took explicit photos of him during a sexting investigation has filed a federal civil rights lawsuit.

Nineteen-year-old Trey Sims of Manassas was charged with child pornography in 2014 when he and his then-17-year-old girlfriend exchanged explicit photos.

The lawsuit says police took photos of Sims' penis after his arrest on the premise of needing a comparison. Police then obtained a search warrant compelling photos of Sims' erect penis, but backed down after public protests.

A year later, the detective on the case, David Abbott, killed himself as police prepared to arrest him on unrelated child sex-abuse charges.

Sims' lawsuit names Abbott's estate and prosecutor Claiborne Richardson as defendants. Richardson did not return a call seeking comment.

The lawsuit was first reported in The Washington Post.