He has plumbed the secrets of the Iran-Contra affair and questioned sitting presidents under oath. He has led investigations that have sent cops, judges and city employees to prison in a sprawling corruption case.

Now, legendary Chicago lawyer Dan Webb will again take up the role of special prosecutor, this time to examine whether a television actor clumsily staged a hate crime attack, then got a sweetheart deal from prosecutors.

Cook County Judge Michael Toomin on Friday appointed Webb and his powerhouse law firm, Winston & Strawn, to probe State’s Attorney Kim Foxx’s controversial handling of criminal charges against Jussie Smollett, duties that could lead to new charges against the “Empire” actor and have considerable impact on Foxx’s bid for a second term.

Before a courtroom packed with reporters, Toomin rattled off the highlights of Webb’s curriculum vitae before swearing in the 72-year-old. Toomin also cited a bizarre bank robbery case in federal court in which the future judge and future U.S. attorney had first met.

“The appointment of Dan Webb is tied to what I learned in that encounter,” Toomin said. “(Webb) is a man guided by a strong moral compass and integrity.”

Webb’s stature in the Chicago legal community surely figured prominently as Toomin looked for a private lawyer to take on a low-level felony case that has drawn outsized attention across the country in the seven months since Smollett first reported being attacked a few blocks from his Streeterville home.

After a costly, month-long investigation, police determined the actor had hired two acquaintances to stage the attack; Smollett was charged with 16 minor felony counts for allegedly making false statements to police investigators.

Controversy swirled around the case for weeks even before Smollett was charged, and reached hurricane force after prosecutors dropped the case against Smollett in March with little explanation. Toomin, in June, ruled in favor of a retired judge’s petition to appoint a special prosecutor, finding Foxx’s announcement that she was “recusing” herself from Smollett’s case before the actor was charged voided his entire prosecution — including the decision to drop the case.

Foxx’s office Friday issued a statement pledging to cooperate with Webb; the statement also noted Toomin’s finding that her office did not have a conflict of interest.

In 2012, Toomin had tapped Webb to serve as special prosecutor to investigate the death of David Koschman at the hands of Richard J. “R.J.” Vanecko, the nephew of former Mayor Richard M. Daley. Vanecko had punched Koschman in the face outside a downtown bar during a 2004 altercation, but was never arrested.

Webb took a case that was then eight years cold to a grand jury, securing an indictment against Vanecko for manslaughter. Webb also produced a 162-page report on the investigation that, while critical of the work of Chicago police investigators, largely cleared the department and the Daley family of any meddling. Vanecko pleaded guilty and was sentenced to 60 days in jail, and another 60 on house arrest.

In a brief press conference in the courthouse lobby Friday, Webb said he did not intend to “reinvent the wheel” and would review the investigations undertaken already by the Chicago police, state’s attorney, FBI and county office of the inspector general, as well as conferring with Smollett’s lawyers and conducting his own interviews of key witnesses.

“I understand this case is important. Judge Toomin has made that very clear to me he thinks the public’s confidence in the criminal justice (is) affected,” said Webb.

“The truth is I have to go where the facts go, and I cannot let politics dictate where I go and how I make decisions,” Webb said. “I intend to expedite everything, but I will go where the facts take me.”

Webb was appointed U.S. Attorney for the Chicago area in 1981 — by President Ronald Reagan, whom he would later depose while serving as special counsel in the Iran-Contra investigation. Politics, and the looming 2020 election for state’s attorney, would not figure the timing of his findings, Webb said.

State law required Toomin to first offer the special prosecutor job others: state Attorney General Kwame Raoul; the Office of the Appellate Prosecutor; then all 101 of Illinois’ elected state’s attorneys. The judge said only two of the 30 state’s attorneys he queried said they would take the case — one said “maybe” — but he deemed those offices unable to properly handle the case. In court Friday, Smollett’s lawyer Tina Glandian protested that one of the volunteers should have been selected if they were willing and able to handle the case.

“You’re right, they were willing, but they were not able, and that is my call,” Toomin said.

Locke Bowman, the Northwestern Law School professor who represented Koschman’s parents when they petitioned the courts for a special prosecutor, said he wished Webb’s investigation had taken a harder look at top CPD officials and the Daley administration. Bowman said Webb and his team are sure to provide a thorough investigation of Smollett’s case, and Webb’s sterling reputation should lend the findings some measure of credibility.

“We are fortunate to have someone of his stature and reputation who is willing to take this on,” Bowman said Friday.