Editor's note: An earlier version of the headline on this article inaccurately reported the location of the defecation. Thomas Tramaglini admitted in court that he defecated under the high school's bleachers.

The former school superintendent accused of pooping on a Monmouth County football field and track earlier this year suffered from a medical condition that affects his bowel movements when he runs, his attorney said Wednesday.

Thomas Tramaglini, 42, of Aberdeen, pleaded guilty in Holmdel municipal court to defecating in public, a non-criminal municipal offense that will require him to pay a $500 fine and court costs. Prosecutors agreed to dismiss charges of lewdness and littering.

Tramaglini, the former Kenilworth school superintendent, made headlines around the world after police announced he had been arrested and accused of defecating at the Holmdel High School's track and field complex. The school's resource officer had set up a surveillance operation to nab the culprit, authorities have said.

Tramaglini admitted to defecating under the high school's bleachers.

He lives about 3 miles from the high school, and was caught in the deed while he was running at the complex, police have said.

His attorney, Matthew Adams, told NJ Advance Media that his client was diagnosed with a form of a medical condition that is known as runner's diarrhea. He said it's brought on from acute blood flow during exercise.

Adams disputes the police's account that Tramaglini was doing this on a daily basis, as was explained in the press release posted on the Holmdel Police Department's Facebook page after he was charged in May.

"There's no evidence he was ever a serial offender," Adams said. "We were ready to go to trial on some of the allegations about certain dates with GPS evidence from his Garmin running watch. That story needs to be told.

So much went on today (in court) that flies in the face of everything, unfortunately, he's been through. He's been through hell and back. He deserves a story that tells the accurate picture."

Days after his arrest, NJ Advance Media published a story that showed there are three portable toilets about 80 steps from the athletic field bleachers. However, whether these portable toilets were left unlocked around the clock or just during certain hours was not clear.

Adams said his client didn't know the toilets were there and that he "was not certain he would have made it even if he did" know.

Tramaglini took a paid leave of absence from his $147,504 a year job in Kenilworth following the incident. In July, the Kenilworth School District accepted Tramaglini's resignation. He was paid over $100,000 in salary, severance and unused vacation time as part of a separation agreement.

Tramaglini intends on suing the Holmdel Police Department over their release of the mugshot that was taken after his arrest.

"The Holmdel Township Police Department has some explaining to do," Tramaglini said.

In response, David Schwartz, an attorney representing the Holmdel Police Department, said, "We don't comment on threatened litigation."

Alex Napoliello may be reached at anapoliello@njadvancemedia.com. Follow him on Twitter @alexnapoNJ. Find NJ.com on Facebook.

Have a tip? Tell us. nj.com/tips