CHICAGO — In a startling about-face on Tuesday that drove a rift between Mayor Rahm Emanuel and local prosecutors, the Cook County State’s Attorney’s Office dropped all charges against the “Empire” actor Jussie Smollett, who had been accused of staging a hate crime attack in the city’s downtown in January.

The decision, announced in court in a hastily convened hearing, slammed the door on a case that became a national fascination and flashpoint, with its overtones of racial and political discord in a city with a history of tension over law enforcement.

It drew waves of celebrity commiseration and torrents of finger-shaking tweets as the victim turned into a suspect and then a defendant. And by Tuesday night, many questions remained unanswered, including why prosecutors had suddenly decided to let Mr. Smollett off only a month after his arrest, and what actually happened at 2 a.m. on Jan. 29 as he was walking back from a late sandwich at a Subway.

Mr. Smollett, who is black, gay and outspoken on social issues, had told the police that two men jumped him, while taunting him with homophobic and racial slurs and yelling “This is MAGA country,” a reference to President Trump’s “Make America Great Again” slogan. The assailants, according to Mr. Smollett, tied a rope around his neck and poured a chemical substance on him. He was briefly treated at a hospital.