LOUISVILLE, Ky. (WDRB) -- A Madison, Indiana, man was arrested in Louisville Saturday afternoon after police say he unwittingly contacted an undercover detective online and arranged to meet with the detective so he could have sex with a child.

The arrest was made as a result of an investigation by the Kentucky Attorney General's Office.

According to arrest reports, 44-year-old Jon Helms reached out to the undercover detective -- not knowing that the person was a member of law enforcement -- and sent the detective several images and videos containing child pornography.

He also allegedly asked the undercover detective if he could have sex with the detective's child. The detective agreed to meet with Helms so that they could do so, but at the meeting, Helms was arrested instead.

He's charged with engaging in the prohibited use of an electronic communications system to procure a minor or peace officer for sexual offenses, as well as several counts of distribution of child pornography.

He is currently being held in Louisville Metro Corrections.

Copyright 2018 by WDRB News. All rights reserved.