On the afternoon of June 14, Justice Department Inspector General Michael Horowitz released his long-anticipated and highly critical report about the conduct of former FBI Director James Comey and other high-level Justice Department and FBI officials regarding their handling of the 2016 Hillary Clinton email investigation.

But largely out of public view, the Inspector General’s Office was in the midst of a perhaps even more consequential matter. Until recently, Deputy Attorney General Rod Rosenstein, Horowitz, and other senior Justice Department officials were grappling with a demand from Donald Trump testing the boundaries between the DOJ and White House, pitting a president willing to blow past traditional norms against an agency attempting to abide the rule of law — and unsure how to draw the line in response.

On May 20, Trump demanded on Twitter that the Justice Department “look into whether or not the FBI/DOJ infiltrated or surveilled the Trump Campaign for Political Purposes.” The president, Republicans on the House Intelligence Committee, and conservative media outlets, most notably Fox News, had been alleging for weeks that the FBI had used a spy to infiltrate Trump’s political campaign — even though they were unable to provide any credible evidence that this was true.

The president of the United States has no formal authority to order the Department of Justice to conduct a criminal investigation. And in this particular instance, there was no evidence of wrongdoing that might rationalize the opening of such an inquiry. Moreover, Trump’s motives in demanding such an inquiry seemed intended to discredit an ongoing criminal investigation by special counsel Robert Mueller of the president himself and several of his top advisers and family members.

But Trump was determined to get his way. On at least three occasions, according to a senior US government official familiar with the matter, Trump brought up the issue personally with Attorney General Jeff Sessions, variously asking, cajoling, and demanding either that he investigate the purported spy or appoint a special counsel to more broadly look at alleged wrongdoing by DOJ and FBI officials who had pursued the Russia interference inquiry.

What Trump was demanding, some senior DOJ officials told me — requesting anonymity due to their sensitive positions — went further than Trump’s past clashes with the Justice Department, including his public criticisms of Sessions for recusing himself from the Russia investigation and constant threats to fire Rosenstein and Mueller.

Even before he was elected, Trump had spoken of using the Justice Department to investigate his political adversaries. He alleged, without evidence, that the DOJ and FBI had covered up for his Democratic opponent, Hillary Clinton, by not bringing criminal charges against her for using a private email server as secretary of state. He regularly encouraged his supporters at his rallies to chant: “Lock her up! Lock her up!”

Once in office, Trump repeatedly demanded that the Justice Department investigate his political adversaries and even specific witnesses who might testify against him in Mueller’s probe. Each time that Trump made such demands, DOJ officials did the best that they could to deflect them — and more often than not succeeded.

But this new demand for an investigation was the most direct threat to the autonomy and integrity of the department in decades, multiple sources within DOJ said. Trump was formally ordering the Justice Department to initiate and conduct an investigation that senior Justice Department officials — both career officials and political appointees — believed to be unwarranted and illegitimate. The formality of Trump’s demand led Sessions and others to believe “this time the threat might be for real,” a senior federal law enforcement official told me.

The Justice Department threaded the needle to avoid a crisis

When Trump formally demanded that the Justice Department look into purported spying on his campaign by the FBI, it put DOJ officials in a bind. To accede to a presidential demand — especially one based on specious evidence — would politicize and compromise the independence and integrity of the department, some senior DOJ officials strongly believed. Moreover, there was good reason that Trump would retaliate against the Justice Department if he did not get what he wanted.

If the Justice Department refused to carry out the order, it was thought that the president might fire the attorney general and possibly Rosenstein, who is overseeing the special counsel investigation into Trump-Russia collusion in the 2016 elections and possible obstruction of justice. Two senior federal law enforcement officials told me in confidence that a purge of this sort would have almost certainly led to a mass resignation of senior Justice Department officials that would have been unprecedented in history.

Mueller’s investigation would have been jeopardized as well. Rosenstein appointed Mueller and oversees his work, deciding whether Mueller can bring certain cases, whether he can expand his jurisdiction, and perhaps most importantly, whether to refer information to the US House of Representatives that might lead to Trump’s impeachment. Were Rosenstein to be fired or resign, the thinking goes, Trump would replace him with someone less inclined to support the investigation.

But Rosenstein came up with what appeared to be an adroit compromise to diffuse the situation. The deputy attorney general decided that — rather than the DOJ itself opening the criminal investigation the president had demanded — he would instead ask Horowitz to look into the matter. President Trump, placated, agreed to the arrangement, and stood down.

As the New York Times reported at the time, Rosenstein’s supporters saw his response to Trump as a “deft deflection” that achieved three immediate needs: “It neutered a troubling request, appeared responsive to the president’s demands and allowed Mr. Rosenstein to keep his job.”

The Inspector General’s Office conducts administrative reviews of possible missteps or misconduct by DOJ and FBI officials and contractors —as well as criminal investigations. In this instance, Horowitz was asked by Rosenstein to conduct a “review” of the matter — although if the IG were to find evidence of a potential crime, he could refer that information to prosecutors.

Likely, Horowitz would find no wrongdoing, senior department officials reasoned, and there the matter would likely quietly die. If by the long-shot chance that Horowitz found evidence of a crime, IGs are empowered to make a criminal referral to other offices in the Justice Department with the power to prosecute. One hazard that Rosenstein faced, however, was that Horowitz might simply refuse to investigate.

A senior Justice Department official told me at the time that they feared Rosenstein only came up with a temporary fix, deferring a potentially more serious showdown if Horowitz declined to formally open an inquiry or dismiss taking it on for lack of evidence. “The initial analysis might find there just isn’t enough to go on,” said the official.

But the Inspector General’s Office has since moved forward with a review of the matter, Horowitz confirmed during testimony on June 19 before two committees in Congress. Responding to a question from Rep. Glenn Grothman (R-WI). Horowitz said his office was “looking at ... campaign-related questions that had been referred to us.” Through a spokesperson, Horowitz declined to be interviewed for this story or comment further.

Just the facts, and the facts are thin

Rep. Trey Gowdy, a Republican from South Carolina, told Fox News on May 29 that after reviewing the highest classified information on the matter, he had not seen any evidence of wrongdoing: “I think when the president finds out what happened, he is going to be not just fine.” Gowdy said that the FBI’s action had “nothing to do with Donald Trump.”

Rep. Tom Rooney, a Republican from Florida who sits on the House Intelligence Committee, has spoken even more dismissively of the president’s claims: “What is the point of saying there was a spy in the campaign when there was none?” Rooney says that the president’s charges simply are “untrue.”

And on June 6, Speaker of the House Paul Ryan said that after reviewing the same classified information, he had seen “no evidence” to support the charges.

Even the president’s attorney, Rudy Giuliani, has conceded that the president made his charges about campaign “spying” based on unsubstantiated information he doesn’t know to be true.

Questions have arisen as to whether even Trump entirely believes his own allegations: The Associated Press reported on May 24 that Trump “told one ally” that he “wanted to ‘brand’ the informant a ‘spy’ believing the more nefarious term would resonate more in the media and with the public.” No evidence whatsoever has come to light to support Trump’s hyperbolic allegations that the FBI engaged in political espionage of his presidential campaign. Trump has claimed that there were “people infiltrating our campaign,” that a “spy” was placed in his campaign by officials at the “crooked highest levels of the FBI,” on the orders of the Obama White House — all at the behest of an amorphous “criminal deep state.”

What is known about the matter is this: The FBI utilized an informant named Stefan Halper, a former State Department official during the Reagan administration, to meet with two of Trump’s campaign aides to attempt to draw them out about their ties to Russians wanting to influence the election. One of those aides, George Papadopoulos, has since pleaded guilty to federal charges of having lied to the FBI about his conversations with people close to the Russian government who offered him and the Trump campaign damaging information about Hillary Clinton.

A former senior political appointee during the Obama administration who supported Rosenstein’s and Horowitz’s decisions, and who asked to speak anonymously due to a current job, told me: “Horowitz will report back that his review found there is no evidence that any of president’s rantings are legitimate and disprove them as the conspiracy theories they are. That’s not entirely a bad outcome.”

But Matthew Miller, who served as the Justice Department chief spokesperson during the Obama administration, sees a bigger concern. “The inspector general does not exist to disprove presidential conspiracy theories. Or even legitimize them by investigating them in the first place,” he said.

“And the deputy attorney general should not be participating in a presidential attempt to conduct an investigation based on no evidence — and sought only to discredit the lawful investigations of the president and his campaign aides.”

Some argue the DOJ has already been severely compromised

In responding to Trump’s demand, Rosenstein said he was referring the matter to the inspector general: “If anyone did infiltrate or surveil participants in a presidential campaign for inappropriate purposes, we need to know it and take appropriate action.”

Jack Goldsmith, who served during the second Bush administration headed the Justice Department’s Office of Legal Counsel, tweeted that Rosenstein was in a “tricky position” and that he should be “cut [some] slack on small accommodations to POTUS outrages—such as the referral to the IG following Trump’s tweet—to allow them to continue to conduct the Russia investigation.”

Ali Soufan, a former FBI counterterrorism agent who specialized in fighting al-Qaeda, tweeted: “Smart response by DOJ! They potentially voided a constitutional crisis by politely, yet effectively, sidelined the President’s attempt to interfere in an ongoing investigation. The Mueller probe continues...for now.”

But critics — among them senior current and former Justice Department officials, such as Miller — argue that, by acceding, Rosenstein not only allowed the Justice Department to be institutionally exploited but lent credence to Trump’s unproven allegations. It also let the president credibly claim that the Justice Department was investigating itself and the FBI for political bias within the special counsel’s inquiry, a foundation of Trump’s attacks on the Russia collusion “witch hunt,” as he has taken to calling it.

Miller and others more broadly argue that each time Rosenstein acquiesces to an unreasonable demand by Trump — even for the best of intentions, foremost protecting the Mueller probe — the independent and apolitical nature of the Justice Department slowly erodes.

More consequential have been demands by congressional Republicans that the Justice Department and FBI provide them classified files on their informant, Halper, who is investigating the Trump campaign’s links to Russia. The DOJ initially refused to turn over the files, saying that to do so could lead to “potential loss of human lives” and “compromise ongoing investigations.” But Trump pressured Sessions, Rosenstein, and FBI Director Christopher Wray to comply anyway.

After Republican Congress members threatened Rosenstein with contempt of court, even impeachment, if he did not do what they warned, Rosenstein defiantly declared: “The Department of Justice is not going to be extorted.” But Sessions and Rosenstein have since capitulated to demands to turn over many of the papers.

What could have happened if Horowitz had refused to pursue the matter further

Sessions and Rosenstein faced a strikingly similar situation late in February, in which they engineered an effort to mollify Trump. The White House and the Republican-controlled House Intelligence Committee had vociferously alleged that there had been irregularities in the way the Justice Department and FBI obtained a Foreign Intelligence Surveillance Act (FISA) warrant to eavesdrop on telephone conversations and read emails by Carter Page, a foreign policy adviser to the Trump presidential campaign. The Justice Department and FBI denied any wrongdoing, but Trump and Republicans on Capitol Hill demanded an investigation.

Wanting to appease an angry president, Sessions said at a February 27 press conference: “We believe the Department of Justice must adhere to the high standards in the FISA court and, yes, it will be investigated. The inspector general will take that as one of the matters they’ll deal with.”

But Vox has learned that, at the time, the Inspector General’s Office had not agreed to conduct any such review when Sessions made his comments.

Even Sessions’s attempt to appease Trump backfired. The president went on to demand a criminal investigation, or better yet, a special counsel to dig into alleged Justice Department and FBI wrongdoing.

“Why is A.G. Jeff Sessions asking the Inspector General to investigate potentially massive FISA abuse,” the president tweeted the following day. “Will take forever, has no prosecutorial power and already late with reports on Comey etc. Isn’t the I.G. an Obama guy? Why not use Justice Department lawyers? DISGRACEFUL!”

Only on March 28 — a full month later — did Horowitz announce that he had decided he would review the FISA issue “in response to requests from the Attorney General and Members of Congress.” That same day, Horowitz wrote the chair of the Senate Judiciary Committee, Sen. Chuck Grassley (R-IA), who had requested the investigation in the first place, to say he was proceeding.

But in the same letter, the inspector general wrote that he had also decided not to investigate three other separate matters that Grassley and Sen. Lindsey Graham (R-SC) had asked of him. Horowitz wrote that one was related to a “pending criminal matter” — referring to the special counsel — and thus he would not investigate.

For that same reason — that the FBI informant is necessarily involved in Mueller’s inquiry — a former and current senior DOJ official both told me they thought it was highly unlikely that Horowitz would launch a formal, separate investigation. But now that the inspector general has, independently, taken up the review, it may have the inadvertent effect of buying Rosenstein a little breathing room.

In the meantime, even Rosenstein’s critics are sympathetic to the jam he and the Justice Department are in, even as they are wary about the compromises already made: “Standing up to Trump … might have provoked the cataclysmic confrontation between the Justice Department and the president that has at times seemed inevitable since the Russia probe began,” former DOJ spokesperson Miller wrote in the Washington Post, on March 22.

“But the alternative is watching the slow erosion of the department’s independence, as the president’s attacks take hold, Republicans in Congress either egg him on or cower in corners, and the norms of presidential behavior drift inexorably in Trump’s direction.”

“For now, Rosenstein seems to be delaying a fight with the president,” Miller wrote. “But that day will come, and we should all hope he recognizes it before it is too late.”

Murray Waas is an investigative reporter who focuses on national security and intelligence matters.

Correction: an earlier version of this article stated that the Inspector General’s Office does not have the ability to conduct criminal investigations. It does.