Under a federal appeals court panel decision issued Thursday evening, Minnesotans must return mail-in ballots by Tuesday to ensure they are counted, upending plans the state had advertised to keep counting absentee ballots postmarked by Election Day for another week.

The decision by a three-judge panel of the U.S. Court of Appeals for the 8th Circuit said a Republican lawmaker and GOP activist could challenge the state’s plans to keep counting ballots after the election — and predicted those received after Election Day could ultimately be invalidated, sending Democrats scrambling to warn voters.

Sen. Amy Klobuchar (D-Minn.) urged constituents not to mail their ballots at all, tweeting: “Because of LAST MINUTE ruling, Minnesota DO NOT put ballots in mail any more....Vote in-person or take mail-in ballot directly to ballot box.”

In a statement, Trump campaign spokeswoman Thea McDonald called the decision a major victory.

The decision came on the eve of scheduled visits to the state by President Trump and Democratic presidential nominee Joe Biden, and marks the second time this week that federal courts have clamped down on swing states that sought to extend counting to give voters extra time to cast ballots amid the pandemic.

On Monday, the Supreme Court prevented Wisconsin from continuing to count mailed ballots received after Election Day. But it has also declined so far to roll back extended deadlines in Pennsylvania and North Carolina.

The 2-to-1 decision issued Thursday voided part of a consent decree approved after a citizen’s group had challenged the state’s counting timeline. Both Democrats and Republicans in Minnesota had agreed to the seven-day grace period in counting absentee ballots.

But the federal court panel strongly condemned the decision-making process, saying lower courts had gone too far in assessing that Minnesota’s legislature had delegated authority to the secretary of state to change election practices to deal with emergencies. They strongly suggested Republicans were likely to prevail and have any votes received after Election Day invalidated.

“Simply put, the Secretary has no power to override the Minnesota Legislature,” the opinion states. “However well-intentioned and appropriate from a policy perspective in the context of a pandemic during a presidential election . . . there is no pandemic exception to the Constitution.”

Under the ruling, Democrats warned that Minnesotans can only be sure the state can accept absentee ballots received by mail by 8 p.m. on Election Day — or before 3 p.m. if voters deliver them in person.

In an interview with The Washington Post earlier Thursday, Minnesota Secretary of State Steve Simon said a ruling against the state could disenfranchise an unknown number of state voters. Simon told reporters Thursday evening that nearly 400,000 ballots have still not been returned.

The judges held oral arguments via conference call on Tuesday — the day the U.S. Postal Service said was the last day to postmark ballots to guarantee their arrival by Election Day.

“I had hoped and reasoned that if the 8th Circuit was going to change a vitally significant deadline, like acceptance of ballots — if they were inclined to do that, I would hope they would have done it an hour after the hearing, even if it was a one-line order,” Simon said before the ruling. “It would be tremendously disruptive at this point . . . to issue an order overturning Minnesota’s postmark rule.”

In a statement Thursday night, Simon said his office was considering its legal options, including appealing to the Supreme Court. “My mission now is to make sure all voters know that a federal court has suddenly changed the rules, and that their ballots need to be received by Election Day.”

In her statement, McDonald said the 8th Circuit “agreed with arguments President Trump has made across the country in the fight to protect the integrity of this election: the Constitution gives power over election deadlines to the state legislature, not backroom consent decrees between Democrat officials and liberal groups.”

The case was brought by Republican state Rep. Eric Lucero and Minnesota GOP activist James Carson. In oral arguments Tuesday, their attorney, Andrew Grossman, argued Minnesota was courting “chaos” by planning to continue counting votes until Nov. 10.

“We are trying to solve that problem now, when voters still have a chance to cast timely ballots,” Grossman said, equating votes that come in after Election Day to ballot-box stuffing.

Lucero and Carson would be injured, Grossman argued, because accepting every ballot “dilutes their votes as a matter of pure arithmetic: When the vote pool goes up, the weight of their individual votes goes down.”

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

“The consequences of this order are not lost on us,” stated the opinion by Shepherd and Grasz. “With that said, we conclude the challenges that will stem from this ruling are preferable to a post-election scenario where mail-in votes, received after the statutory deadline, are either intermingled with ballots received on time or invalidated without prior warning.

“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.”

Dave Weigel and the Associated Press contributed to this report.

Correction: A previous version of this story incorrectly said the judges ruled the state must reject ballots that arrive after 8 p.m. on Election Day. This story has been updated to reflect that judges predicted ballots received after Election Day could ultimately be invalidated and ordered them to be kept separate.