A former Hermosa Beach police officer who lives in Long Beach has been charged with soliciting sex from an undercover sheriff’s deputy who he thought was a 16-year-old girl, the Los Angeles County District Attorney’s office announced Thursday.

Todd A. Lewitt, 51, used a dating website on July 26 to contact the deputy who was posing as a teenager, prosecutors allege.

He then arranged to meet up with her so the two could have sex, according to the district attorney’s office. When Lewitt arrived at the meeting spot in East Los Angeles later that day, he was arrested, authorities said.

He pleaded not guilty Thursday to one felony count of meeting a minor for lewd purposes and is being held in lieu of $75,000 bail, according to authorities. Lewitt could face up to four years in prison if he’s convicted.

The Daily Breeze, which reported Lewitt’s arrest last month, said he was the subject of multiple internal investigations and an FBI investigation into excessive force during his time at the Hermosa Beach Police Department.

He was fired in 2005 when he allegedly tried to bring a gun through security at John Wayne Airport, according to the newspaper.

After a legal battle, Lewitt got his job back, but later reached a settlement with the department after another legal fight and left the agency in 2016, according to the Daily Breeze.

Jeremiah Dobruck is managing editor of the Long Beach Post. Reach him at [email protected] or @jeremiahdobruck on Twitter.