Democratic presidential nominee Hillary Clinton will not be required to testify in person about her use of a private email server as secretary of state but will have to answer questions in writing about the setup close to election day in November, a federal judge ruled in a civil lawsuit Friday.

The decision by U.S. District Judge Emmet Sullivan removes a potential political headache for Clinton. Sitting for a videotaped deposition could have created a distracting spectacle for Clinton’s campaign and prolonged discussion of her trustworthiness, an issue that has hurt her in polls.

Sullivan, in a 28-page order, ruled on a July 8 request by the conservative legal group Judicial Watch in a lawsuit probing whether Clinton’s private email setup thwarted public records laws from 2009 to 2013.

Sullivan split the difference between positions taken at a July hearing. At that time, Clinton lawyer David Kendall – joined by State and Justice department attorneys – argued questioning of Clinton would be moot because questions about the server had been investigated at length by the FBI, State Department inspector general and Congress.

Attorneys for Judicial Watch argued that only Clinton can directly explain why she acted as she did, and that she should have to do so under oath with follow-up questioning.

In his opinion Friday, Sullivan found that Judicial Watch had shown that “extreme circumstances” warranted questioning Clinton, but that the group’s claim that it should be allowed to do so in person was without merit because it could also ask follow-up questions in writing.

“Because Secretary Clinton has not answered for the record and under oath … and because her closest aides at the State Department do not have personal knowledge of her purpose in using the system, the Court will permit testimony from Secretary Clinton” regarding the creation and operation of her email setup for State Department business, Sullivan wrote Friday.

In a statement, Clinton campaign spokesman Brian Fallon called Judicial Watch “a right-wing organization” that has attacked the Clintons for decades to damage them politically.

Judicial Watch President Tom Fitton said the group was pleased that Sullivan “ordered Hillary Clinton to provide written answers under oath to some key questions about her email scandal” and that it would move quickly. “The decision is a reminder that Hillary Clinton is not above the law,” Fitton said.