Kangaroo court, season 2

A Cook County judge on Friday ordered the surprise appointment of a special prosecutor to investigate the sudden dismissal of all charges against Jussie Smollett, saying the short-lived prosecution may have been legally invalid from the beginning.

Judge Michael Toomin ruled that State’s Attorney Kim Foxx had the right to withdraw herself from overseeing the prosecution of the onetime “Empire” actor but held no legal authority to then delegate that responsibility to her top deputy.

With the deputy holding no real authority, the Smollett case made its way through the court system without a prosecutor at the helm, the veteran judge said.

“There was no master on the bridge to guide the ship as it floundered through uncharted waters, and it ultimately lost its bearings,” Toomin wrote in the 21-page opinion. “… The unprecedented irregularities identified in this case warrants the appointment of independent counsel to restore the public’s confidence in the integrity of our criminal justice system.”

The decision marked a victory for Sheila O’Brien, a former state appellate judge who sought the special prosecutor in largely a solo effort, and a political blow for Foxx, the first-term officeholder who is seeking reelection next year.

“We’ll get the truth, the whole truth, under oath, and that’s what this is about,” O’Brien told a throng of reporters in the lobby of the Leighton Criminal Court Building.

It also represents bad news for Smollett, who potentially could be recharged by a special prosecutor. The whole episode has been costly for Smollett, who won’t return to his role for the final season of the Fox series “Empire.” He also faces a lawsuit from the city of Chicago seeking to recoup the cost of police overtime for investigating the incident, and his attorneys have been sued for defamation by two brothers who claim Smollett paid them to help stage an attack on him.

Foxx’s office had opposed the appointment of a special prosecutor, arguing it would duplicate the efforts of the county’s inspector general’s office, which has been investigating the controversy since April. But Foxx requested the IG’s probe, raising questions about its independence in some eyes.

In a brief statement Friday, Foxx didn’t answer the most pressing question: Would her office appeal Toomin’s decision to a higher court? Instead, she simply said she “respectfully" disagreed with the judge’s decision.

Smollett, who is African American and openly gay, found himself at the center of an international media firestorm after he reported in late January that two men attacked him near his apartment building in the Streeterville neighborhood, slipping a noose around his neck and shouting racist and homophobic slurs.

But Smollett was charged on Feb. 20 with disorderly conduct after Chicago police determined that he had agreed to pay $3,500 to the two brothers to stage the attack. On March 8, he was indicted on 16 counts of disorderly conduct alleging he lied to police.

Less than three weeks later, however, Foxx’s office made the stunning announcement that all charges had been dropped against Smollett with no explanation at an unannounced court hearing.

Weeks earlier, Foxx had recused herself from overseeing the prosecution after communicating with a Smollett relative. Later, her office claimed Foxx had not recused herself “in the legal sense,” a move that would otherwise have required the entire office to withdraw from the prosecution.