Federal agents accused a Philadelphia police officer Wednesday of trading pornographic images of children online while working overnight shifts in the Accident Investigation Division.

James Strohm, 47, allegedly used the screen name “fungirl12321” to upload dozens of illicit images to Mocospace, an online gaming community, between Feb. 14 and March 11.

When investigators traced the activity to a city-controlled wireless network — and eventually Strohm — the 22-year veteran of the force admitted to using the application for sexual gratification, according to a criminal complaint filed in his case.

Strohm told FBI agents Wednesday, when they showed up at his home in the Bustleton section of the city, that he had totally messed up his life, according to his arrest affidavit.

Strohm faces one count of distributing child pornography, a charge that carries a five-year mandatory minimum sentence. He is in federal custody pending a bail hearing Monday. It was not immediately clear whether he had retained an attorney.

A Philadelphia police spokesperson refused to say whether Strohm had been suspended, noting only that the department was aware of the investigation.

“However,” the spokesperson said in a statement, “criminal activity involving child victims is especially heinous, and is wholly incongruent with the core values of the Philadelphia Police Department.”