A Monmouth County Prosecutors office detective goes undercover as a 14-year old boy as part of an investigation into a post allegedly made online by a Keansburg man who wanted to have sex with the child, according to the MCPO

The detective posing as the boy and William McMahon agreed on a place in Freehold Township to meet and that's where the 64-year old was arrested.

McMahon is charged with one count each of second degree Attempted Sexual Assault, second degree Luring or Enticing Child, third degree Attempted Endangering the Welfare of a Child.

The undercover investigation was conducted by the Monmouth County Prosecutor's Office Computer Crimes Unit and Monmouth County Internet Crimes Against Children (ICAC) Task Force that commenced in late July.

An undercover detective, posing as a 14-year old boy, responded to an-online posting by McMahon seeking to have a "sleep over" with the child.

During the course of continued on-line discussions, McMahon made clear his interest in having sex with the child.

On August 3, McMahon traveled from his home in Keansburg to an indoor entertainment center in Freehold Township, where he believed he would meet the 14-year old boy to further his plan to sexually assault the minor.

McMahon was found outside the venue and arrested instead by officers from the Monmouth County Prosecutor's Office and U.S. Bureau of Homeland Security.

If convicted of second degree Attempted Sexual Assault and Luring charges, McMahon faces a maximum sentence of 10 years in New Jersey state prison, Megan's Law, and parole supervision for life.

If convicted of the third degree Endangering charge, McMahon will face a maximum sentence of five years in state prison.

McMahon remains jailed in the Monmouth County Correctional Institution.

He is scheduled to have a detention hearing on Thursday August 9 in front of Monmouth County Superior Court Judge James J. McGann at 9 am.

The case is assigned to Monmouth County Assistant Prosecutor Martha Nye.

Despite these charges, every defendant is presumed innocent, unless and until found guilty beyond a reasonable doubt, following a trial at which the defendant has all of the trial rights guaranteed by the U.S. Constitution and State law.

More From The Jersey Shore: