The Foreign Intelligence Surveillance Court on Tuesday ordered the government to explain what the FBI will do to ensure the bureau does not mislead judges again when applying for surveillance orders like those used in the 2016 investigation of the Trump campaign.

The four-page order from Judge Rosemary M. Collyer, the presiding judge of the secretive court, publicly rebuked the FBI for 17 omissions and errors contained in applications to monitor the electronic communications of Carter Page, a former Trump campaign adviser.

In a 434-page report released last week, Justice Department Inspector General Michael Horowitz found serious failures in FBI procedures for ensuring that applications to the court are complete and accurate.

“When FBI personnel misled [the Justice Department] in the ways described above, they equally misled” the court, Collyer wrote in a highly unusual and pointed statement. “The FBI’s handling of the Carter Page applications, as portrayed in the [inspector general’s] report, was antithetical to the heightened duty of candor” expected of filings under the Foreign Intelligence Surveillance Act (FISA).

The FBI said that Director Christopher A. Wray already has ordered more than 40 changes to address issues raised in the inspector general’s report.

“As Director Wray has stated, the Inspector General’s report describes conduct by certain FBI employees that is unacceptable and unrepresentative of the FBI as an institution,” the FBI said in a statement. “FISA is an indispensable tool in national security investigations, and in recognition of our duty of candor to the Court and our responsibilities to the American people, the FBI is committed to working with the FISA Court and [the Justice Department] to ensure the accuracy and completeness of the FISA process.”

Collyer is the same judge who signed the first surveillance application for Page sought by the FBI in October 2016. Since the court was established in 1978, civil libertarians have frequently criticized its structure as ripe for abuse by government officials.

But in recent years, it has been President Trump’s supporters and conservatives who have been most critical of the FISA process, arguing that unelected bureaucrats targeted the president’s campaign out of political animus. Trump has called the investigation of him a failed coup, and several Republican senators argued last week that the FISA court could not continue without significant changes to its operation.

The inspector general did not find documents or testimony indicating that political bias motivated the FBI to investigate Trump aides. But he found a raft of other problems in how the FBI pursued the case, including that an FBI lawyer altered an email in 2017 to state that Page was not a source for the CIA, when in fact Page had provided the agency information in the past.

That document alteration has been referred to a prosecutor for possible criminal charges. In the meantime, the FISA court has ordered the Justice Department and FBI to provide information about any other surveillance applications in which that same lawyer, Kevin Clinesmith, was involved. A lawyer for Clinesmith did not respond to a request for comment.

The FISA court order raises the prospect that the Page case — which officials conceded received more internal scrutiny than many other applications to the court — may point to a larger problem.

“The frequency with which representations made by FBI personnel turned out to be unsupported or contradicted by information in their possession, and with which they withheld information detrimental to their case, calls into question whether information contained in other FBI applications is reliable,” Collyer wrote.

The accuracy of filings to the FISA court is considered critically important within the government, largely because the court’s work is so secretive that defense lawyers do not get to challenge the factual assertions behind such warrants.

“We can’t trust the secret intelligence court alone to police this process,” said Neema Singh Guliani, a lawyer at the American Civil Liberties Union. “Congress must radically reform the FISA process to increase accountability and ensure that there is a meaningful opportunity to challenge the government’s allegations in FISA applications.”

Horowitz’s review of how the FBI investigated a possible conspiracy between Trump associates and Russia to influence the 2016 election concluded that the FBI had met the low legal threshold to open an investigation but that the pursuit of Page as a suspected agent of the Russian government was plagued by errors, misstatements and omissions.

As a result of his findings, Horowitz has announced he will conduct a broader audit to see whether factual problems with FISA applications extend beyond the Page case. The Justice Department and the FBI go to the FISA court for surveillance authorities in the country’s most sensitive national security cases involving terrorism or espionage.

Collyer’s order requires the government to submit a sworn submission describing what it has done and plans to do “to ensure that the statement of facts in each FBI application accurately and completely reflects information possessed by the FBI that is material to any issue presented by the application.”

In his defense of the bureau, Wray said the problems discovered revolved around a small number of employees who no longer work there and should not taint the entire workforce.

Attorney General William P. Barr and Trump have argued that the inspector general report was too lenient on the FBI. Barr called the bureau’s conduct “a travesty.”

Barr has tapped the U.S. attorney in Connecticut, John Durham, to conduct an investigation of how the FBI and other intelligence agencies worked on the case.

After the report’s release, Trump tweeted angrily that Wray, whom he called “the current FBI director,” was in charge of a “badly broken” agency. “With that kind of attitude, he will never be able to fix the FBI,” Trump declared.

The inspector general concluded that central to the FBI’s court applications for surveillance of Page were a set of allegations provided by former British intelligence officer Christopher Steele. The Steele dossier, as it came to be known, contained allegations against Trump, Page and other Trump associates, and those allegations have been the subject of intense political fighting since they became public in early 2017.

Horowitz concluded that the FBI repeatedly found evidence that contradicted some of the claims in Steele’s reports but did not share that exculpatory information with the Justice Department or the FISA court. Horowitz also concluded that the FBI repeatedly overstated Steele’s reliability as an informant.

In an interview with Fox News Sunday, former FBI director James B. Comey defended the FBI but backtracked from his claim last year that FISA court applications were handled in “a thoughtful, responsible way.”

Comey said he was “overconfident” in the procedures designed to ensure the accuracy of applications to the surveillance court. “There was real sloppiness, 17 things that either should’ve been in the applications or at least discussed and characterized differently. It was not acceptable and so [Horowitz] is right. I was wrong.”