PLAINFIELD — A city police officer fired for having sex in his police car while on duty has lost a years-long battle to get back his job.

Appellate judges on Tuesday upheld the termination of Fernando Sanchez, who admitted to having sex with the woman and then lied about it, officials said.

Authorities say Sanchez admitted to the illegal hookup during a Union County Prosecutor’s Office investigation into a police sergeant who had been accused of coercing the same woman into stripping for him while he masturbated in a public parking lot. Sgt. Samuel Woody was on duty and in uniform when he engaged in the criminal sexual contact, which got him sentenced to six years in prison in 2014.

Officials said Sanchez lied to prosecutors when he told them that he didn’t think he had sex with the woman in his patrol car.

After Woody’s trial in 2013, the police department’s internal affairs unit investigated Sanchez and questioned him about the sexual escapade.

Sanchez told a department investigator that he had not had sex with the woman in his car. Two days later, however, he changed his story to say that he had.

City officials also said Sanchez "frequently" met with other "paramours" to have sex while on duty.

Unlike Woody, Sanchez was never charged with a crime.

The city, however, fired him based on violations of several departmental regulations and state rules. The termination was upheld in 2015 by the Civil Service Commission.

Sanchez appealed to Superior Court, arguing that his indiscretion warranted only a long suspension.

But a two-judge panel on Tuesday denied the appeal.

“Law enforcement officers are held to a higher standard of responsibility and conduct than other public employees,” their decision says.

The judges noted that Sanchez had been suspended once before for 40 hours for an unrelated offense. But that didn’t matter.

“Sanchez’s improper conduct was sufficiently egregious and unbecoming to his office so as to warrant removal even if he had no prior disciplinary history,” the decision says.

More From WOBM: