The City Council’s Finance Committee on Monday signed off on a $2 million settlement to a pair of police officers who blew the whistle on police corruption and paid a heavy price for it.

The settlement with police partners Shannon Spalding and Daniel Echeverria was reached on the eve of their trial, averting the need for Mayor Rahm Emanuel to comply with a federal judge’s order to testify about the code of silence that the mayor acknowledged exists in the Police Department.

But, the Emanuel administration has insisted that Chicago taxpayers are not being asked to cough up big bucks just to keep Emanuel off the stand.

Rather, First Deputy Corporation Counsel Jenny Notz said the alleged retaliation against Spalding and Echeverria and the damage done to the credibility of police brass who would argue otherwise makes it unwise for the city to roll the dice and risk going to trial.

Spalding and Echeverria allege they were retaliated against for helping to expose police corruption nearly a decade ago.

The partners had alleged their superiors told them in 2007 to ignore evidence of criminal wrongdoing by Sgt. Ronald Watts. Instead, on personal time, they said they reported it to the FBI.

What the officers thought would end with a simple meeting eventually turned into “Operation Brass Tax.” And while they tried to limit their involvement in the investigation to personal time, it became so time-consuming that the officers were forced to tell CPD’s internal affairs. As a result, they were formally detailed to the FBI.

Spalding and Echeverria spent two years working exclusively on the Watts investigation. Watts was sentenced in October 2013 to 22 months in prison for shaking down drug dealers.

But lawyers for the two officers say Internal Affairs Chief Juan Rivera blew their cover. Spalding and Echeverria were branded “rat motherf——” and told their bosses didn’t want them in their units. They were allegedly told their careers were over, given undesirable assignments and shifts and told fellow officers wouldn’t back them up. Their actions allegedly made the brass so angry that Spalding was warned to “wear her vest” so she wouldn’t be shot in the parking lot for crossing the thin blue line.

“One of the defendants … charged with some of the retaliatory conduct resigned in December of 2015 before the Police Department initiated disciplinary proceedings against him for his role in the re-investigation of the David Koschman case,” Notz told aldermen Monday.

“Also in 2015, a key CPD witness who would have rebutted some of the plaintiffs’ most serious allegations of retaliation relating to their experiences in the Narcotic Unit was indicted on felony perjury charges relating to testimony that he gave in another case. … The police superintendent recommended [in March] that this officer be terminated.”

Notz added, “The plaintiffs would certainly, if this case went to trial, use these recent developments to attack the credibility of two of the defense’s key witnesses at trial, making this case difficult to win.”

After hearing those lopsided facts, Finance Committee Chairman Edward Burke (14th) wondered aloud why the whistleblowing partners are “settling for only $2 million if they have the potential to hit it out of the park?”

Ald. Patrick Daley Thompson (11th) is the cousin of R.J. Vanecko, who pleaded guilty to involuntary manslaughter and served a two-month jail sentence for throwing the punch that killed David Koschman. But even Thompson said: “It sounds like a tough case for the city.”

Also on Monday, the Finance Committee authorized a $500,000 settlement to Patrice Robinson, who suffered a complex fracture to the spine in 2014 after she was a passenger in a car that was rear-ended by a Chicago Police vehicle going the wrong way down a one-way street at a high-rate of speed — through a stop sign — while responding to a call of an officer needing assistance.

Robinson was a passenger in the vehicle that was struck by the police car, spun and hit a light pole. She underwent two spinal surgeries.

During an extraordinary speech to the City Council last December, Emanuel apologized for the “systematic breakdown” that culminated in the “totally avoidable” police shooting of Laquan McDonald and acknowledged the “code of silence” in the Chicago Police Department he once tried to keep out of a court record.

Emanuel is the first mayor in Chicago history to acknowledge the “code of silence” that has some police officers covering up the wrongdoing of colleagues or, at the very least, turning a blind eye to it.

But Corporation Counsel Steve Patton has maintained that the mayor’s repeated statements do not mean the city will have to capitulate in any lawsuit that mentions the “code of silence.”

“The fact that there is a code of silence, and at least some officers on some occasions don’t report wrongdoing … doesn’t mean that it happens every time or all the time,” Patton said on the day the settlement was announced.

The whistleblower lawsuit was pending in federal court for years. But the political and legal landscape changed forever Nov. 24, 2015.

That’s when Emanuel complied with a court order to release dashcam video of white Police Officer Jason Van Dyke firing 16 rounds into the body of black teenager Laquan McDonald. Van Dyke was charged with first-degree murder hours before the now-widely-viewed video was released.

Inspector General Joe Ferguson subsequently recommended firing 11 police officers accused of covering up the McDonald shooting or bungling the investigation of the shooting.

Police Superintendent Eddie Johnson followed Ferguson’s lead on five of the officers, but disagreed on one. The remaining five officers either retired or resigned after Ferguson made his recommendations.