CHICAGO — A judge ruled Friday that a special prosecutor needs to investigate Cook County State's Attorney Kimberly Foxx's handling of the Jussie Smollett case and that the "Empire" actor should be re-examined for possible criminal charges.

Cook County Circuit Court Judge Michael Toomin ruled in favor of Sheila O'Brien, a former appellate judge who had called for a special prosecutor to find why charges were dropped against Smollett over his allegedly false report that he was the victim of a racist, homophobic attack.

"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," wrote Toomin, who is presiding judge over the Cook County Juvenile Justice Division.

Not only should a special counsel take a fresh look at Foxx's actions, but the independent prosecutor should look at "all aspects of the case" and "if reasonable grounds exist to further prosecute Smollett, in the interest of justice, the special prosecutor may take such action as may be appropriate," Toomin wrote.

While Smollett was indicted for allegedly making a false police report, he was never put on trial. So double-jeopardy protections against being prosecuted after an acquittal would not apply here.

O'Brien hailed Toomin's ruling.

"It’s very thorough and it’s very complete," O'Brien said. "Well get the truth, the whole truth, under oath."

Smollett was accused of falsely reporting what police say was a staged racist and anti-gay attack on himself in January in Chicago. He was indicted by a grand jury of felony counts that he committed disorderly conduct by making a false report, according to a criminal complaint.

Smollett was arrested in February, but Foxx's office dropped charges against him in March. The actor has maintained his innocence and insists he was attacked.

Foxx recused herself from a possible prosecution of Smollett, saying she had contact with the actor's family when he was believed to be a crime victim.

Toomin said Foxx was right to take herself out of the case, but then wrong to place another prosecutor from her office in charge of it. She appointed First Assistant State's Attorney Joseph Magats, to oversee the matter, when she should have sought an outside prosecutor, according to Toomin.

"Yet for reasons undisclosed even to this day, Foxx instead chose to detour from the mandated course, instead appointing Mr. Magats as `the acting State's Attorney for this mater,' " Toomin wrote.

Toomin excoriated Foxx for creating "an entity that did not exist."

"There was and is no legally cognizable office of Acting State's Attorney known in our statutes or to common law," Toomin ruled. "Its existence was only in the eye or imagination of its creator, Kim Foxx."

Foxx tried to claim a measure of victory, saying Toomin agreed with her decision to recuse herself. The prosecutor, however, still maintained a special prosecutor isn't warranted.

"In any event, I respectfully disagree with the court's conclusion that, in the absence of any conflict, the appointment of a special prosecutor is required,” according to a statement from Foxx. “As always, I remain committed to transparency, justice, and the public safety of the communities we serve.”

O'Brien said Foxx's handling of the case cried out for an outside's examination.

"I did this because it had to be done," O'Brien said of her request. "Someone had to do it. I had time and a typewriter."

Smollett's trainers, Abimbola “Abel” Osundairo and Olabinjo “Ola” Osundairo, have previously said they helped stage the Chicago attack.

Gloria Schmidt, a lawyer for the brothers, said they're willing to answer any questions from a special prosecutor.

"The special prosecutor would have an opportunity to look at the evidence and effectively do this whole case over again — re-charge him, re-arraign him, reconvene the grand jury," Schmidt said. "It's like we're back to square one."

The saga began on Jan. 29 when Smollett filed a report that he had gone out for food at around 2 a.m. after returning from New York when masked men hurled racist and homophobic slurs before beating him.

The 36-year-old actor, who is black and gay also said his attackers poured what he believed was bleach over him and put a noose around his neck in the upscale Streeterville neighborhood.

But police could not find any security footage from the many surveillance cameras in the neighborhood to back up Smollett's claims. The actor also initially declined to provide phone records that could show he was speaking with his manager just as the alleged assault happened.

By Feb. 16, Chicago police publicly stated that "the trajectory of the investigation" changed, implying that Smollett was now a suspect. Smollett was charged Feb. 20 with felony disorderly conduct for the allegedly false report he made with Chicago police.

He was indicted on March 8 before prosecutors dropped all charges on March 26, in a move that angered police and then-Mayor Rahm Emanuel.

Johnson had previously said Smollett invented the hate crimes and took "advantage of the pain and anger of racism to promote his career.”

Puskar reported from Chicago and Li from New York.