GettyImages-85801741
A police chief in Leechburg, Armstrong County, Pennsylvania, was arrested after he was accused of trying to solicit sex online from an undercover agent posing as a 14-year-old girl, Jan. 5, 2018. In this photo, a police officer watches a scene of crime in Pittsburgh, Pennsylvania, April 14, 2009. Getty Images

A police chief in Leechburg, Armstrong County, Pennsylvania, who lost part of his arm in a fireworks accident last year, has been arrested Friday after he was accused of trying to solicit sex online from an undercover agent posing as a 14-year-old girl, state prosecutors have alleged.

The attorney general's office confirmed that Leechburg Police Chief Michael W. Diebold, 40, was arrested on Friday at a Sheetz gas station in Westmoreland County, where he had allegedly hoped to meet up with the 14-year-old girl.

Diebold was charged with two felonies: unlawful contact with a minor and criminal attempt to commit involuntary deviate sexual intercourse and his bond was set at $500,000, Pennsylvania Attorney General Josh Shapiro said.

The police chief has been scheduled for a preliminary hearing by District Judge Cheryl Peck-Yakopec on Jan. 16.

Diebold has been accused of allegedly sending sexually explicit messages and inappropriate photos to the undercover agent via the Kik messenger app with the username "Kutecop4you," according to a criminal complaint, obtained by ABC News affiliate WTAE.

"Diebold admitted that he knew that sexual contact with a 14-year child was wrong and illegal and that his life was totally over," the complaint said.

In the criminal complaint, Special Agent Daniel Block, who was the agent posing as the 14-year-old said his communications with Diebold began after he went undercover to respond to an online ad titled "Dominate male police officer seeks fun, discreet, sub playmate-m4w."

According to the complaint, the posting said, "I am a dom male that is also employed as a full time police officer. I hope that does not scare you off. I am white, straight, good looking, clean, d/d free, mentally stable and fun. I can also host or travel. I do have pics to share and I am very discreet. I am looking for a female sub for ongoing play sessions. I do not have a set type of woman so any age, race or status may email me. I respect any and all limits and you do not need to be experienced. I hope to hear from someone soon. KIK=kutecop4you’s," WTAE reported.

"This case is particularly heinous because the perpetrator is a public official, sworn to serve and protect the community," Attorney General Josh Shapiro said in a statement, according to the Pittsburgh Post-Gazette. "We have a zero-tolerance policy for the sexual abuse of children and my office will prosecute any offender to the fullest extent of the law, no matter who they are."

During his arrest on Friday, Diebold was interviewed without an attorney present and he "admitted to being the individual who was communicating with the purported child during all the communications."

"Diebold stated that he has been utilizing the internet to post ads in the personal sections for the last several years. Diebold acknowledged to having conversations about sex with the other Kik messenger user, the purported minor in this investigation that he was attempting to meet at Sheetz," the complaint added.

Part of Diebold's left arm was amputated in June last year after a firework exploded during the borough fire company's carnival, and the news had garnered national attention. Emergency workers had been able to save him then, using a belt as a tourniquet to stem the bleeding.

Two weeks later, Diebold married his high school sweetheart in a ceremony widely covered by local media, according to Mirror.co.uk.