A San Jose man who allegedly tried to groom Fairfax boys for sex pleaded guilty Thursday to felony child harassment.

Richard Thomas Williams, 54, will face three years in prison when he is sentenced July 7, said Deputy District Attorney Kendra Rudolph.

Williams, a registered sex offender, has a prior record that includes oral copulation with a minor under 16 years old and lewd acts with a victim 14 or 15 years old. He is classified as a “high-risk” sex offender in the state Department of Justice database.

Williams was arrested in March 2017 after an investigation by the Fairfax Police Department. The investigation began after a 16-year-old boy reported that a man approached him and two friends at a Fairfax restaurant twice in two weeks.

The man offered the teens money and food to help him wash cars and also made sexually suggestive statements, police said. The man gave each teen a nickname, his cellphone number and instructions not to report their discussions to their parents.

Fairfax police conducted a sting operation and identified the man as Williams.

The charge Williams pleaded guilty to alleges child harassment by a someone convicted of one of several sex offenses in the past.

According to the San Jose Mercury News, Williams’ prior history includes a case in Santa Clara County in which he hired boys to wash cars with him at an athletic club and allegedly required them to bathe with him in the locker room.