Pennsylvania’s top elections official warned a federal judge Tuesday of chaos should the court block Philadelphia and two other counties from using their new voting machines during the 2020 presidential elections.

“Your honor, I can’t overstate … the chaos that would ensue, frankly,” Secretary of the Commonwealth Kathy Boockvar said of the primary election. “The voters who just learned a new machine would have to have something, some ability to vote.”

And while getting new replacement machines in time for the April 28 primary election “would not be possible,” Boockvar said, she was also not sure whether it would be feasible for the general election in November, calling it “extremely difficult” with a tight timeline and other electoral changes being made this year.

Lawyers for 2016 Green Party presidential candidate Jill Stein are seeking to have the voting machines used in Philadelphia decertified by the state, arguing they violate a lawsuit settlement that requires voter-verifiable paper ballots for every voter in Pennsylvania. City and state elections officials and their lawyers sought Tuesday to demonstrate both that the machines meet the agreement’s requirements, and that decertifying them would create massive problems.

Counties would have to scramble to select, purchase, and implement new machines, Boockvar said, a task made more difficult because “everything takes longer, takes more resources, takes more preparation in a presidential year than in any other year.”

Boockvar was the main witness Tuesday, fielding questions from lawyers for Stein, the state, and the judge. A lawyer for Stein argued that counties could replace their voting machines in a matter of a few months.

Stein and the Pennsylvania voters joining her as plaintiffs say the counties should replace the machines in question, the ExpressVote XL from vendor Election Systems & Software, because they make it difficult to properly verify and tally votes, undermining election security.

The machines, they say, violate the settlement by relying on bar codes, not properly allowing voters to confirm their selections, and producing a paper record that is not technically a ballot under Pennsylvania law.

The state, joined by Philadelphia, argues that the machines are secure, that the record produced is a paper ballot and can be confirmed by voters before being cast, and that blocking the machines from use in 2020 would be costly and disruptive.

U.S. District Judge Paul S. Diamond has no timeline for a decision on whether the case should continue. But if he allows the case to move forward and it ultimately leads to the statewide decertification of the ExpressVote XL voting system, Philadelphia and two other counties would need to quickly purchase and implement new voting machines, at a cost of millions of dollars, by November.

At the same time, officials are preparing for high turnout in the hotly watched presidential contest — while implementing wide-ranging changes that elections administrators already worry will be difficult to implement.

On the other hand, the plaintiffs say, using insecure machines in a critical battleground state like Pennsylvania could also disenfranchise voters by potentially miscounting their votes.

The underlying lawsuit filed by Stein’s group accused Pennsylvania of violating the constitutional rights of voters in 2016’s presidential election because its voting machines were susceptible to hacking and the electronic voting machines most voters used left no paper record, making a manual recount impossible.

In 2018, Gov. Tom Wolf ordered all counties in the state to replace their voting machines in time for the 2020 presidential election, requiring paper records. The state then reached an agreement with Stein and the other plaintiffs that following through on that order would settle the suit.

But Stein and other advocates for hand-marked paper ballots say the model of machine selected by Philadelphia, Northampton and Cumberland Counties violates that agreement.

The ExpressVote XL is a touchscreen system that prints a piece of paper with a series of bar codes and plain text listing voters’ choices. The ballots are cast when they are fed back into the machine to be read.

The Pennsylvania Department of State has ordered the plain text paper list of vote choices to be the official record of the vote. In theory, if a machine was hacked or malfunctioned, votes could still be recorded accurately during an audit or recount.

Critics say the machines are difficult to use and the paper records they produce often go unchecked by voters before being submitted. The machines are also more vulnerable than simpler systems in which voters mark choices on a paper ballot that is then scanned, critics say.