Eighteen down, two to go.

An NYPD detective hit with so many misconduct and brutality lawsuits that he was once described as a “monster cop” has now knocked off all but two of the 20 cases lodged against him.

Det. David Terrell, an 18-year veteran of the force, was cleared in the 18th claim against him on Tuesday when a federal judge threw out a lawsuit filed in 2017 by a Bronx man.

The only cases still pending is a claim by career criminal Pedro Hernandez, who sued in state Supreme Court after the case was tossed in federal court three times, and a suit that has sat dormant since it was filed three years ago by murder suspect Salim Wilson, who has been jailed awaiting trial since 2017.

“Thank God it’s over. That’s it,” Terrell told The Post Wednesday. “It put a damper on my career.”

“I was moving in the right direction to get promoted to second-grade but the former commissioner didn’t have my back at the time,” he said, referring to recently retired Commissioner James O’Neill.

At least five of the misconduct or brutality suits naming Terrell in state or federal court were settled before they went to trial, including a 2013 case in which he was one of 11 police defendants.

“As we’ve said from the beginning, these are nothing but a bunch of frivolous lawsuits,” Terrell’s lawyer, Eric Adams, said Wednesday. “The department didn’t back him up. I have a whole long list of who should be held accountable, including fake media and the (Bronx) DA’s office. Who’s going to be held accountable for ruining this man’s reputation?”

In the case dismissed this week, Jerome Roman claimed that Terrell and a half-dozen other cops took him into custody three times without charging him in 2014 and 2015.

Steven Hirsch

In one instance, Roman claimed Terrell and another cop “emerged from a marked police car, grabbed (Roman’s) arm, handcuffed him, and arrested him.”

Roman was charged with criminal trespass in July 2014, but the case was dismissed by the Bronx District Attorney’s Office in February 2015, according to court papers.

Roman’s lawsuit claimed Terrell and other cops took him in three other times in July and August 2014 and June 2015 — but never charged him with any crimes.

However, the officers’ lawyers said Roman was legally detained on a trespassing complaint in August 2014 and cited for possession of marijuana in the 2015 arrest — making that arrest legit.

They also argued that Roman’s July 2014 trespassing charge was dropped on “speedy trial” grounds, not on the merits.

US Magistrate Judge Sarah Netburn agreed and dismissed the complaint.