This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

A former Hermosa Beach police officer accused of trying to meet an undercover detective he thought was a 16-year-old girl for sex denied a felony charge Thursday, officials said.

Prosecutors charged Todd A. Lewitt, 51, on Wednesday with one count of meeting a minor for lewd purposes, the Los Angeles County District Attorney’s Office said.

After pleading not guilty at Thursday’s court appearance, he was ordered back to Los Angeles County Superior Court Sept. 24 for a preliminary hearing setting, DA’s office spokesman Paul Eakins said.

Investigators arrested Lewitt in July after he contacted a purported 16-year-old girl through a dating website, the DA’s office said in a written statement. But the supposed girl was actually an undercover deputy with Los Angeles County Sheriff’s Department.

Deputies arrested Lewitt when he arrived at the designated meeting place in East Los Angeles, the DA’s office statement said.

If convicted as charged, Lewitt faces up to four years in state prison.

He was released after posting $75,000 bail the day after his arrest.

Lewitt’s attorney, Pat Carey, told the Daily Breeze that the allegation is false. He said the undercover deputy claimed to be 20 years old, not 16.

Lewitt reportedly left the Hermosa Beach Police Department in 2016 following a decade-long legal battle with his employer. He was fired from the department in 2005 after allegedly trying to bring a loaded gun through security at Orange County’s John Wayne Airport, according to the Breeze.

He appealed his termination and was reinstated, but was placed on leave again when he refused to take a medical background check, the Breeze reports.

Lewitt reportedly settled with the city for more than $530,000, left the department and began working as a private security guard.