A three-judge panel of the 8th U.S. Circuit Court of Appeals said Thursday that Minnesota absentee ballots that arrive after Election Day should be separated from other ballots in case they are later invalidated by a court.

The ruling doesn't block Minnesota's seven-day extension for counting absentee ballots outright — but it does order a lower court to issue a ruling to segregate the ballots so they can be “removed from vote totals in the event a final order is entered” that finds them unlawful.

The ruling orders Secretary of State Steve Simon to inform local election officials so they can comply, and sends the case back to the lower court for further proceedings. It also sets the stage for post-election litigation.

The decision is likely to create voter confusion, with people who haven't returned their absentee ballots scrambling to make sure their votes count. People who are worried their absentee ballots may not arrive on time may drop off their ballots at a designated location, vote early at an early voting station, or vote in person on Election Day.

As of last Friday, more than 500,000 of some 2 million requested absentee ballots remained outstanding. The state was due to update totals on Friday.

“The consequences of this order are not lost on us. We acknowledge and understand the concerns over voter confusion, election administration issues, and public confidence in the election," the majority wrote. But they said those problems were preferable to a post-election scenario where invalidated and valid votes are mixed.

“Better to put those voters on notice now while they still have at least some time to adjust their plans and cast their votes in an unquestionably lawful way,” the majority wrote.

The ruling is a win for Republicans, who argued that the extension — which had been approved in both state and federal courts due to the COVID-19 pandemic — violated federal law that establishes Nov. 3 as the date of the 2020 election.

Democrats called the ruling “an attack on democracy” brought about by Republicans.

“This absurd and misguided opinion will toss out the rules that have been in place since before voting began in September,” state party Chairman Ken Martin said. “Now, with just five days before election day, and Republicans surely heading for defeat at the polls, the Republican Party is responsible for potentially disenfranchising thousands of Minnesotans who were prepared to vote by mail in the coming days.”

State GOP Chairwoman Jennifer Carnahan called the ruling a “big win for election protection and freedom.”

Minnesotans “already have six weeks for people to vote early,” Carnahan tweeted. She called the extra period “unnecessary and just a move by the left to play around with this election.”

The case now goes back to U.S. District Judge Nancy Brasel, who previously upheld a state court agreement that allowed ballots postmarked on or before Election Day to be counted if they are received by Nov. 10.

Judge Bobby Shepherd, an appointee of President George W. Bush, and Judge L. Steven Grasz, appointed by President Donald Trump, formed the majority. Judge Jane Kelly, appointed by President Barack Obama, dissented.

“At this point, it is simply too late for any absentee voter who has not yet mailed their ballot to do so with confidence that it will arrive by Election Day,” Kelly wrote. She said the ruling “has the effect of telling voters -- who, until now, had been under the impression that they had until November 3 to mail their ballots -- that they should have mailed their ballots yesterday (or, more accurately, several days ago).”

But Shepherd and Grasz took issue with the way the extension was approved in state court, saying Simon had no authority to override election laws set by the Legislature. And they said voter confusion was inevitable once he told voters there would be an extension.

Simon, a Democrat, said the ruling could disenfranchise voters who were relying on the extension, and he accused the Republicans who brought the lawsuit of trying to "sabotage the system for political gain.

“I won’t let any Minnesota voter be silenced. My mission is now to make sure all voters know that a federal court has suddenly changed the rules, and that their ballot needs to be received by Election Day," Simon said.

Republicans have tried to block voter expansion across the country, and the Minnesota decision comes as similar extensions have gone before the U.S. Supreme Court with mixed results. The nation’s high court recently left a three-day extension for counting absentee ballots in Pennsylvania in place, but refused to reinstate a six-day extension in Wisconsin.

A majority of states require mail-in ballots to be received by Election Day, while others accept them days or even weeks later if they are postmarked by Election Day. Some states made changes, citing an expected flood of absentee ballots due to the coronavirus pandemic.

Minnesota was one of those states, with a consent decree in state court that changed the rules so ballots postmarked on or before Nov. 3 could be accepted for up to seven days after the election.

Republican state Rep. Eric Lucero and GOP activist James Carson, who both would participate in the Electoral College if President Donald Trump carries Minnesota, opposed the state agreement and took the case to federal court. Their lawsuit, backed by the conservative-leaning Honest Elections Project, argued that an extension would create chaos and dilute the value of their votes by counting “unlawful” ballots after Election Day.

Lucero said counting votes that come in after Election Day erodes confidence in elections and opens the door to fraud and abuse, and that Simon should have asked legislators to change the law. “The court was clear: ‘There is no pandemic exception to the Constitution,'" he said in a statement.

Trump narrowly missed winning Minnesota in 2016 and had vowed in 2020 to become the first Republican to capture the state since Richard Nixon in 1972. But recent polls have showed Joe Biden leading.

Follow Amy Forliti on Twitter: http://www.twitter.com/amyforliti