An imminent Wisconsin Supreme Court decision on whether the Green Party presidential ticket has qualified to appear on the state ballot has upended election preparations and raised the prospect of a last-minute addition that could benefit President Trump in a state he won by a hair in 2016.

The pending court case comes after the Wisconsin Elections Commission declined on Aug. 20 to put presidential contender Howie Hawkins and his Green Party running mate, Angela Walker, on the Nov. 3 ballot because their signature petitions featured two different addresses for Walker. State election officials argued against letting the ticket on the ballot, saying the campaign failed to meet the requirements.

Hawkins and Walker filed a legal petition with the state’s high court, which on Thursday ordered local governments not to send any ballots out until it reaches a decision.

That has left election clerks across the state in limbo. They warned that millions of ballots have already been printed, and cities and towns have begun stuffing and labeling envelopes and preparing to send out more than 1 million ballots that have been requested so far by voters.

Now, local officials may need to order new ballots — and cough up the money to pay for them — while facing imminent state and federal deadlines to send them to voters. The state requires that ballots be sent to voters who have requested them by Sept. 17, and the federal deadline for mailing ballots to overseas and military voters is two days later, Sept. 19.

After those deadlines, local governments must send ballots out on a rolling basis as they receive additional requests, up until the state deadline for requesting a ballot on Oct. 29.

“This is really nuts, honestly,” said Scott McDonell, the clerk in Dane County, who was on the phone with the county’s printing contractor this week in preparation for the ruling and expected his staff to work through the weekend to prepare envelopes, instructions and mailing labels for the arrival of new ballots.

Democrats say they fear that a last-minute change to the ballot will create havoc for election officials and confusion among voters with just weeks to go before the election. There is also the possibility that a Green Party ticket could siphon votes from their nominee, former vice president Joe Biden.

In a state that Trump won by just under 23,000 votes four years ago — less than a percentage point — a third-party candidate could attract a difference-making number of votes. In 2016, Green Party presidential candidate Jill Stein won more than 30,000 votes in Wisconsin.

Hawkins suggested in an interview that Trump supporters had helped the Green Party ticket with its legal claim before the state Supreme Court. The party’s petition was filed by attorneys from the Milwaukee-based von Briesen & Roper law firm, which has a history of representing Wisconsin Republicans.

“You get help where you can find it,” Hawkins told The Washington Post when asked whether Republicans had financed the legal action. “They have their reasons and we have ours.”

Hawkins’s campaign manager, Andrea Merida, later denied that, saying she “literally used Google” to find a law firm because others had turned her down. She said she doesn’t know the partisan affiliation of donors from Wisconsin supporting the Green Party ticket.

A von Briesen lawyer listed on the court filing, Andrew Phillips, did not respond to a request for comment. The chairman of the Republican Party of Wisconsin, Andrew Hitt, denied any involvement in the effort. A spokesman for the Republican National Committee declined to comment.

Questions about the Green Party ballot petition began in August, when a state voter complained that there was a discrepancy in Walker’s address on the party’s signature pages. The campaign said that Walker had moved during the signature-gathering phase.

But campaign officials failed to respond to a request from the state elections commission to fix their signature sheets, which they could have done by submitting an affidavit explaining the address discrepancy.

In a report to the Wisconsin Elections Commission ahead of its Aug. 20 meeting, the commission’s staff argued that the affidavit would have “easily cleared up confusion” — but absent that, the commission is left with “legitimate arguments” against the petition’s validity.

Weeks later, the Green Party ticket asked the Supreme Court to intervene.

The state Supreme Court is controlled by a 4-to-3 conservative majority that has regularly ruled in favor of Republican interests over the past decade, notably in 2014, when it upheld a law ending collective bargaining for teachers championed by then-Gov. Scott Walker (R).

Wisconsin is one of at least five states where The Post has identified Republicans, including activists who had recently voiced support for Trump, working on an effort to put rapper Kanye West on the ballot. As with the Green Party ticket, the GOP involvement has raised fears among Democrats that West’s candidacy is intended to peel votes from Biden.

In West’s case, Lane Ruhland, a Madison lawyer and former general counsel for the state Republican Party, delivered his ballot petition to state regulators in early August.

The commission voted 5-to-1 in August to bar West from the ballot, arguing his petition had been submitted moments after a 5 p.m. deadline on Aug. 4. West challenged that decision in state court. A judge ruled against him Friday night, but the decision is expected to be appealed.

Like other county clerks across Wisconsin, McDonell is now waiting to find out if he must order new ballots.

McDonell and other officials said they were particularly frustrated that the Green Party ticket waited two weeks to ask the state Supreme Court to intervene, especially because the Wisconsin Elections Commission gave the campaign an opportunity to fix the deficient signatures when they were filed.

“If they had just sent an email confirming that they had moved, they would be on the ballot right now,” McDonell said. “We could have added the Green Party and it would have been fine, and that’s not still true today. The fact that the Green Party took two weeks to file — I don’t even know what to say about that.”

Local governments were made aware of the possibility of a ruling on Thursday, when the Supreme Court ordered them not to send out any ballots until it determined whether the Green Party would qualify.

The state elections commission’s online system shows that as many as 378,000 ballots have been mailed by cities and towns, but most local governments reported Friday that they had not actually sent any yet, but were still in the preparatory stages, stuffing envelopes and affixing mailing labels.

A decision for the Green Party would force all counties to print new ballots — an expensive job for the state’s larger jurisdictions but less so for smaller communities. Dane County, for instance, will have to spend around $100,000 to replace its ballots.

McDonell said it would probably take a week for the new ballots to arrive once he orders them, meaning voters will have that much less time to return their ballots by Wisconsin’s Nov. 3 deadline.

That’s significant at a time when the U.S. Postal Service is under fire for recent operational changes, such as a reduction of overtime and limits on mail trips, that have prompted reports of backlogs nationwide.

This week, the Postal Service sent a mailer to postal customers urging them to “start today” on the process of voting by mail, and to mail ballots “at least” seven days before Election Day.

Rosalind S. Helderman and Alice Crites contributed to this report.