A Morris County man who set up an encounter with an undercover detective posing as a 13-year-old girl after placing an ad on Craigslist was sentenced to three years in state prison Friday, authorities said.

Robert Elmi, 64, of Gillette.

Robert Elmi, 64, spent weeks texting and e-mailing with the undercover, eventually arranging to meet her at a Union County diner on Nov. 9 of last year, according to the state Attorney General's Office.

"He told the 'girl' he would take her back to his apartment, where they would drink, watch TV, kiss and perform oral sex on each other," the office said in a statement announcing the sentencing.

Instead, Elmi was arrested by State Police.

He was among 79 suspects arrested in "Operation Safety Net," a nine-month statewide investigation that ended last year.

Elmi, of Gillette, pleaded guilty on Jan. 31 to a charge of luring a child. He was sentenced Friday by Superior Court Judge Candido Rodriguez in Union County. As part of the sentence, he is required to register as a sex offender under Megan's Law and will be subject to parole supervision for life.

"May all of these malicious predators like Elmi be put on notice and know that the child they are planning on abusing may very well be a New Jersey state trooper on the other end of the computer," Col. Patrick Callahan, the head of the State Police, said in a statement Friday.

S.P. Sullivan may be reached at ssullivan@njadvancemedia.com. Follow him on Twitter. Find NJ.com on Facebook.