A man caught masturbating in front of a whole bunch of schoolchildren in Phoenix didn't understand what the problem was, police say.

To clarify, police say Ronald Dean told officers he didn't understand what the problem was while he was smoking crack in an alley behind the school with his pants around his ankles, according to court documents obtained by New Times.

According to the documents, a gym teacher had just led as many as 23 children between the ages of 10 and 13 had just been led outside the AmeriSchools Academy -- a charter school near 15th Avenue and Camelback Road -- when they all saw Dean.

Dean, who was in an alley "in plain view" of the school, pulled his pants down to his knees and "began masturbating in front of the crowd of students," according to the court documents.

The gym teacher tried to usher the kids back inside as quickly as possible, as police were called.

Dean was found in the same alley, with his pants around his ankles.

Dean said he didn't do anything wrong -- he was just sitting there smoking crack, he explained to the officers, according to the documents.

"I was just sitting here getting high," police quote Dean as saying.

Officers found Dean's crack pipe, as well as some hydrocodone pills he didn't have a prescription for, the documents state.

A police probable-cause statement describes how Dean didn't really understand what he was doing was wrong, and the reporting officer had to explain to him why masturbating in front of an entire class of schoolchildren is not a good thing.

According to officer's statement, Dean finally conceded, "I guess I could have gone underneath the bridge overhang."

Gee, maybe. Dean was booked into jail on charges of indecent exposure, and possession of a narcotic drug.

State prison records show Dean was released from prison in 2010 after serving four years for burglary.

Send feedback and tips to the author.

Follow Matthew Hendley on Twitter at @MatthewHendley.