David E. Kendall is an attorney at the Washington law firm Williams & Connolly LLP, where he represents former president Bill Clinton and former secretary of state Hillary Clinton.

Donald Trump is used to pronouncing the words “You’re fired.” But if the president decides he wants to get rid of special counsel Robert S. Mueller III, he will find that a much more complicated task than dispatching a contestant on “The Apprentice.” Justice Department regulations will make it difficult, legally as well as politically, to abruptly short-circuit the pending investigation.

With Attorney General Jeff Sessions having recused himself from the probe into the Trump campaign and possible collusion with Russia, the deputy attorney general, Rod J. Rosenstein, appointed Mueller on May 17 to “conduct the investigation confirmed by then-FBI Director James B. Comey” when Comey testified before the House Intelligence Committee on March 20. Justice Department regulations also give Mueller the authority “to investigate and prosecute federal crimes committed in the course of, and with intent to interfere with, the Special Counsel’s investigation, such as perjury, obstruction of justice, destruction of evidence, and intimidation of witnesses.”

This assignment was not a casual gig, but an appointment made by the acting attorney general pursuant to federal law, which provides specific protections to ensure the independence of the special counsel. Justice Department regulations provide that a special counsel may be removed from office only by the “personal action” of the attorney general (in this case, Rosenstein, who is acting in that capacity) and only for good cause. There must be written findings of “misconduct, dereliction of duty, incapacity, conflict of interest” or “other good cause, including violation of Departmental policies.” On paper at least, those are pretty strong safeguards to protect Mueller’s freedom from unwarranted interference and obstruction.

Now, could President Trump order Rosenstein to fire Mueller? Could he unilaterally and summarily rescind the Justice Department regulations that protect Mueller from being fired? Does he have inherent constitutional authority as president, as some have claimed, simply to ignore or suspend the regulations and, as head of the executive branch, fire Mueller himself and order the investigation closed?

Any of those steps would almost certainly result in the resignation of Rosenstein, and likely other Justice Department officials, reminiscent of the “Saturday Night Massacre,” when President Richard Nixon ordered the firing of Watergate special prosecutor Archibald Cox. Attorney General Elliot Richardson resigned, having promised Congress not to dismiss Cox except for cause — much like the assurances Rosenstein has provided in his congressional testimony. Deputy Attorney General William Ruckelshaus also refused the firing order and resigned, leaving the task to Solicitor General Robert Bork, who not only fired Cox but also retroactively rescinded the underlying Justice Department regulation creating the Office of the Watergate Special Prosecutor.

As with the Saturday Night Massacre, however, any move to fire Mueller would likely not be the end of the matter — or of the criminal investigation. In the uproar that ensued after Cox’s firing, the remaining prosecutors in the office continued their work and a new special prosecutor, Leon Jaworski, was selected. In this situation, even if the Trump Justice Department did not move to name a new special counsel, it would be remarkable, if not unprecedented, for the president to order that a pending criminal investigation touching on his conduct be made to disappear altogether.

Moreover, Cox’s firing triggered a lawsuit by members of Congress who claimed it interfered with their ability to get to the bottom of the Watergate matter. Even though Cox had by then returned to teaching at Harvard University, U.S. District Judge Gerhard Gesell ruled that “the firing of Archibald Cox in the absence of a finding of extraordinary impropriety was in clear violation of an existing Justice Department regulation having the force of law and was therefore illegal.” In addition, Gesell found, abolishing the prosecutor’s office was itself illegal: “An agency’s power to revoke its regulations is not unlimited. Such action must be neither arbitrary nor unreasonable.”

It boils down to this: When you’re the target or subject of an investigation, even if you’re the president of the United States, you don’t get to call the balls and strikes as to whether there has been criminal conduct or the investigation is necessary. It’s quite possible that a fair and thorough investigation will confirm the president’s oft-stated belief that neither he nor his campaign was guilty of any improper activity. But for the present it’s simply irrelevant that Trump feels guiltless and persecuted. The rule of law, not the whim of an elected official, no matter how lofty, defines both what the applicable legal standards are and who gets to make decisions about those standards. And that includes firing a special counsel.