A New York City judge has ordered that President Trump sit for videotaped testimony in a lawsuit brought by protesters who say they were assaulted by Trump’s security guards during the 2016 campaign.

The Bronx-based judge, Doris M. Gonzalez, wrote that Trump’s testimony is “indispensable” to the trial, which is scheduled to begin Thursday. She wrote he must therefore be examined by videotape before then, though Trump is likely to ask for a delay.

The protesters argue Trump, his campaign and business should be held liable for the actions of security guards who were working for the company. They say, even if Trump didn’t directly order the guards to act, he had control over their actions because they were his employees and his campaign trail rhetoric gave them the impression that violence would be condoned.

The suit alleges Trump’s head of security, Keith Schiller, punched one of the men in the head while trying to grab from him a sign that read, “Make America Racist Again!” Schiller has said he was simply trying to make space on the sidewalk and that he struck the protester only after the man grabbed him suddenly from behind.

Attorneys for Trump did not respond to requests for comment. They can appeal and seek to stay the ruling while their appeals are considered.

The case is one of a number of matters working their way through state and federal courts that will likely test the limits of presidential power. Because it was filed in August 2015 — just two months after Trump declared his candidacy for the presidency — it is more advanced than other matters.

The U.S. Supreme Court ruled in 1997 that the president can be sued in federal court. The ruling came as President Bill Clinton was being sued by Paula Jones, a former Arkansas state employee, for sexual harassment and, as a result, Clinton was required to sit for a videotaped deposition in the case in 1998. Clinton settled the case and it never went to trial.

Trump, by contrast, has been ordered to offer testimony for use at the New York trial, a rare instance of a jury sitting in judgment of a sitting president.

If the Bronx jury rules that the security guards acted inappropriately and Trump was to blame, they could impose sizable punitive damages on the president.

The Bronx matter stems from a September 2015 rally outside Trump Tower in which four men of Mexican descent wore Ku Klux Klan outfits and carried large banners. They were protesting Trump’s campaign comments about immigrants.

The group alleges Trump’s security guards emerged from the building and shoved and pushed them, grabbing and ripping their signs. In a moment partially caught in news footage at the time, one of the men, Efrain Galicia, alleges Schiller struck him in the head with a closed fist and another guard placed his hands around his neck and attempted to choke him.

After Trump took office, he appointed Schiller as director of Oval Office operations, a position he held until September 2017. Trump’s lawyers are also representing him in the case and did not respond to requests for comment.

Benjamin N. Dictor, an attorney for the plaintiffs, on Friday sent a letter to Trump’s attorney asking him to “advise what date, time and location” Trump would be made available.

He said the plaintiffs want to try to determine whether the president has ever authorized his staff to use force.

The rally took place about a week after Schiller forcibly removed Univision anchor Jorge Ramos from a crowded news conference. In news footage of the incident, Trump appeared to catch Schiller’s eye before the security chief moved toward the reporter.

Trump was present in Trump Tower at the time of the rally, preparing to give a news conference.

“This is a case about speech on a New York City public sidewalk and violence used against people on that sidewalk,” Dictor said. “It will be up to a jury of New Yorkers whether an individual who owns a business can be responsible for the actions of his employees.”

In court filings, Schiller has said the men’s large banners were blocking the sidewalk. In a sworn statement, he said he attempted to collect the signs and bring them into the building but Galicia grabbed at him from behind. Believing Galicia was grabbing for his gun, he swung around and hit him with an open hand, he said.

Trump’s attorneys argued the president should not be required to testify because he was not present at the protest and has no relevant information to share about how it unfolded.

They wrote that the plaintiffs have advanced no reason that Trump’s testimony is necessary in the case “beyond an apparent desire to subject the President to politically fueled cross-examination on issues that have no real bearing on the claims or defenses in this proceeding.”

Gonzalez rejected that argument, ruling that Trump’s testimony is critical and he should find time to provide it.

“No government official, including the Executive, is above the law,” she wrote.

Walter E. Dellinger III, who served as solicitor general while Clinton was president, said that, in the Jones case, the Supreme Court urged trial judges to give significant deference to a president’s busy schedule. For that reason, Trump could seek to delay next week’s trial to allow more time for his participation.

Higher level courts in New York could also examine more closely the question of whether his testimony is truly needed to determine whether he can be blamed for the actions of his employees.

“He could possibly get out of it on the grounds that his testimony is not needed — but he’s unlikely to have any constitutional defense,” Dellinger said.

Trump could face particular peril if forced to testify under oath in the case, where any falsehoods he told could lead to further investigations. In the Jones case, Clinton said under oath that he did not have a relationship with Monica Lewinsky, leading to his impeachment by the U.S. House of Representatives in 1998.

The Bronx case was filed in state court. Trump has tried to argue that, even if the president can be sued in federal court, like in the Clinton-Jones matter, he should be spared from litigation filed under state law.

In March, an appellate level court in New York rejected that argument in a different case, in which a former “Apprentice” contestant, Summer Zervos, alleges the president defamed her by publicly denying her accusations that he kissed and groped her without consent in a Beverly Hills hotel.

Discovery in that case has begun and Zervos is expected to seek to depose Trump.