Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A former school superintendent who was charged with defecating on a high school’s track has asked New Jersey’s attorney general to investigate whether police acted unlawfully when they took his mug shot and released it to the media.

The Holmdel Township Police Department's "actions were the height of willful misconduct, professional irresponsibility and a total disdain for the law,” attorney Matthew Adams said Monday in a letter to Attorney General Gurbir Grewal.

Thomas Tramaglini was charged with lewdness, littering and defecating in public in May after police said he repeatedly defecated on the Holmdel High School track. Tramaglini pleaded guilty in October to relieving himself in public once in the midst of a medical emergency and paid a $500 fine.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Tramaglini submitted to the court and prosecutor's office proof of a medical condition known as runner's diarrhea that often affects distance runners and that is brought on from acute blood flow during exercise.

Tramaglini was accused of "heinous acts" that he did not do, his attorney told NBC News on Wednesday.

"It's a travesty what has occurred to him because of this," Adams said. "His life has been ruined.”

Tramaglini resigned as superintendent of the Kenilworth school district after a 20-year career in public education.

In his letter to the attorney general, Adams said that state law prevents police from taking and releasing booking photos of people charged with low-level offenses such as those Tramaglini faced.

"It is critical to the functioning of our criminal justice system that we support law enforcement," Adams said in the letter. "Equally important is that we hold law enforcement accountable for misconduct so that the inappropriate actions of a few do not tarnish the good work of the many."

A spokesman for Grewal told NBC News on Wednesday the letter was being reviewed but declined to comment further.

David Schwartz, an attorney representing the Holmdel Police Department, told NBC News that the township "does not comment on matters of pending or threatened litigation, or to such letters as the Tramaglini letter of February 25, 2019."