A state judge in Illinois ruled on Wednesday that former President Donald J. Trump had engaged in insurrection and was ineligible to appear on the state’s primary ballot. The decision creates uncertainty for the state’s March election, in which early voting is already underway.

It also adds urgency for the U.S. Supreme Court to provide a national answer to the questions that have been raised about Mr. Trump’s eligibility to appear on ballots in more than 30 states.

The judge, Tracie R. Porter of the State Circuit Court in Cook County, said the State Board of Elections had erred in rejecting an attempt to remove Mr. Trump and said the board “shall remove Donald J. Trump from the ballot for the general primary election on March 19, 2024, or cause any votes cast for him to be suppressed.”

But the decision by Judge Porter, a Democrat, was stayed until Friday, which means Mr. Trump can remain on the Illinois ballot at least until then. A spokesman for the Trump campaign said the ruling was unconstitutional and vowed to appeal.

“Today, an activist Democrat judge in Illinois summarily overruled the state’s Board of Elections and contradicted earlier decisions from dozens of other state and federal jurisdictions,” the spokesman, Steven Cheung, said in a statement.