A former NYPD detective admitted Friday to falsifying evidence and then lying about it under oath during a federal court proceeding.

Michael Foder, 42, now faces up to five years behind bars and a $250,000 fine following his guilty plea to a single perjury count.

“I falsely testified on the dates I put,” the now-former detective told Brooklyn federal Judge Pamela Chen, referencing an October 2015 proceeding in which he took the stand during a pre-trial hearing for the armed robbery of a livery cab driver.

Foder initially claimed to have shown the victim photo arrays of potential suspects on Nov. 27, 2015, and Feb. 14, 2016.

But feds later discovered the dates didn’t match with reality, and he was charged with perjury in February. He resigned from the NYPD earlier this month, officials said.

On Friday, Foder said the photo arrays were shown on later dates than he’d testified to, and admitted making false statements under oath.

“It is imperative that New Yorkers are able to trust their police to tell the truth,” NYPD Commissioner James O’Neill said in a statement. “Police officers swear an oath to hold themselves accountable to the highest standards of ethics and integrity. And when they intentionally violate that promise, they tarnish the reputation of all good cops, make their jobs much more difficult, and erode the trust we have worked so hard to earn in all of our communities.”

US Attorney Richard Donoghue blasted Foder for defiling his commitment to the people of New York, saying the ex-cop committed “a gross violation of the oath he took as a sworn witness and as a law enforcement officer.”

Foder remains out on bail pending sentencing, and declined comment as he left court.

Defense attorney James Moschella called his client a “young, inexperienced officer who made a bad decision.”

“He is a good man, and honorable man,” the lawyer said. “Human beings are not robots, they make mistakes.”