Philadelphia’s votes are going to take even longer to count than expected.

As the world watched for Pennsylvania’s largest city to deliver results that will help determine who wins the White House, a state court victory for President Donald Trump’s reelection campaign disrupted the vote tallying Thursday and left officials working at diminished capacity.

For two hours at midday, the city’s count was paused altogether after the state Commonwealth Court ordered that Trump’s campaign observers had to be able to stand within six feet of any tables where counting is taking place in order to meaningfully monitor the process.

Afterward, city lawyers told a federal judge, workers sat tabulating ballots in only the first of several rows of tables, allowing observers to watch from behind metal barriers. That left the other tables empty, equipment unused, and ballots counted at a slowed pace.

Within hours of the order, the city appealed the ruling to the state’s top court, which has yet to decide whether it will resolve the matter. The counting of votes continues around the clock, but it will go slower unless that appeal is granted, said city commissioner Al Schmidt, one of Philadelphia’s three top elections officials.

“If we win the appeal, we can go full-tilt again,” Schmidt, the lone Republican on the elections board, said in an interview Thursday night.

Schmidt and the other commissioners, Lisa Deeley and Omar Sabir, have painstakingly avoided estimating when their army of workers will finish counting Philadelphia’s 350,000 mail ballots. Schmidt declined to measure the full impact of the disruption.

“What we know is it’s certainly two hours later than it would have been. So that’s two hours lost,” he said. “And then a somewhat diminished capacity since then to comply [with the order.]”

The disruption came as Joe Biden appeared to be on the cusp of winning the presidency, and his top campaign officials accused the president’s campaign of waging legal battles over “utterly immaterial matters, like where they may be permitted to stand and observe while the counting takes place.”

And so the normally mundane and mechanical task of opening envelopes and unfolding ballots has become the focus of worldwide interest, with national TV networks broadcasting the livestream of the Convention Center hall where counting is taking place.

Outside, demonstrators from both sides of the political aisle gathered in the early afternoon, waving signs and flags as they chanted — one group calling for a full count, the other alleging the election was being stolen.

The drama created by the Trump campaign’s false claims that illegitimate votes were being counted was heightened as Trump advisers Corey Lewandowski and Pam Bondi went in and out of the hall and appeared before the crowd. The media spectacle brought dozens of members of the press, many national and international.

Philadelphia District Attorney Larry Krasner and a few other elected officials designated as canvassing monitors also arrived and went inside the hall.

“The Trump campaign and his political operatives want you to think that somehow there is some kind of circus going on,” Philadelphia City Councilmember Helen Gym said after observing the ballot counting inside the Convention Center. “But they’re the circus, and they’re the clowns right now.”

The Trump crowd held signs that echoed the president’s attempts to spread the false allegation that votes were being counted that shouldn’t have been, bearing phrases such as “Stop the Cheat” and “Sorry, polls are closed.”

By late afternoon, the numbers of Trump supporters had dwindled; the ones who remained stood on the street as the “Count Every Vote” demonstration turned into an hours-long dance party.

It’s been clear for months that Pennsylvania would take days to count votes legally cast before or on Tuesday. (In addition, it is long-standing state law that ballots from overseas and military voters can arrive up to one week after Election Day and be counted.)

Gov. Tom Wolf on Thursday morning condemned Trump, who wrote “STOP THE COUNT!” on Twitter as several states, including Pennsylvania, continued to count legally cast ballots.

“Pennsylvania is going to count every vote and no amount of intimidation will stop our dedicated election officials in our municipalities,” Wolf said in a statement.

In her ruling Thursday, Commonwealth Court Judge Christine Fizzano Cannon ordered that canvassing monitors be granted access to observe “all aspects” of the process from no more than six feet away, overturning a previous ruling from a lower court in Philadelphia. The Trump campaign had contended that its monitors were being kept too far away from votes being counted to view the process.

For instance, one Trump canvassing monitor told a Common Pleas judge in Philadelphia on Tuesday that some tables where clerks were counting votes in the Convention Center were up to 100 feet away from where he was stationed. Monitors were kept behind a waist-high metal fence to separate them from the operations.

Those restrictions applied to both Republican and Democratic poll monitors.

City officials said that setup complied with state law, taking into consideration necessary precautions to protect vote counters during the coronavirus pandemic.

“This is a massive operation,” the city’s lawyers wrote in a court filing Thursday, noting that the Board of Elections officials have been processing more than 350,000 mail and absentee ballots since 7 a.m. on Election Day.

“This endeavor requires a great deal of space, because of the physical volume of the ballots involved and the need to ensure social distancing protocols among the facility’s hundreds of workers,” they wrote. “Because of the need for staff to circulate unimpeded and the security and privacy concerns involved with handling ballots, the Board cannot permit outsiders to wander freely through this workspace.”

They also argue that Pennsylvania’s election law requires only that party or candidate representatives be permitted to be in the room during canvassing — but does not give them the right to object to specific ballots.

The Trump campaign filed for an emergency injunction in federal court Thursday afternoon to stop the county from counting ballots, saying the city was not complying with the state order and thus not giving it equal access to observing the ballots, but a judge dismissed that after urging both sides to reach an agreement.

At a hearing, Judge Paul Diamond told Trump’s campaign it didn’t necessarily have the right to be within a specific number of feet of election workers. He asked both sides to agree on a numbers of observers that both Republicans and Democrats would be allowed, and that Trump’s campaign — which said some of its observers had not been allowed into the convention center — submit a list of names to the city.

Diamond urged the lawyers to act in good faith in reaching agreement and reminded them that even as they spoke, the votes were being counted and the moment would pass.

“The world has its eyes on Philadelphia,” he said. “It’ll take its eyes off soon enough.”

Staff writers Maddie Hanna, Justine McDaniel and Ellie Silverman contributed to this article, along with Angela Couloumbis of Spotlight PA.