President Trump has called special counsel Robert Mueller’s investigation into ties between the Trump campaign and Russia a “total WITCH HUNT with massive conflicts of interest,” and his lawyers have called for an end to the probe.

As Mueller’s investigation gets closer and closer to the president himself — with the indictment of Trump’s former campaign chief Paul Manafort and new subpoenas for Trump Organization documents related to Russia — Trump’s continued criticism is stoking fears that he might try to fire Mueller in an attempt to make the whole investigation go away.

But would that actually work? Would firing Mueller really end the Russia probe?

I asked several legal experts, and it turns out there’s a lot of confusion over the answer. “No one knows because this isn’t an everyday occurrence,” Ethan Leib, a law professor at Fordham University, told me. “We are all learning on the fly.”

There are all sorts of permutations as to what Trump could try to do — from replacing Mueller while keeping the special counsel’s current legal team in place to disbanding the team altogether.

For the moment, any decision on Mueller’s fate is in the hands of Deputy Attorney General Rod Rosenstein. That means Trump would have to convince Rosenstein to fire Mueller, or fire Rosenstein and replace him someone who was willing to do so.

Rosenstein has repeatedly said that he does not see a reason to get rid of Mueller, a sign that he likely wouldn’t go along with Trump if he were pressured to oust the special counsel.

Trump could remove Rosenstein and replace him with someone willing to fire Mueller and disband the special counsel team. That would likely stop any further investigation into Trump’s campaign and Russia, but it wouldn’t get rid of the indictments Mueller’s team has already filed.

“I don’t think this case will magically disappear,” Laurie Levenson, a former federal prosecutor who was appointed by President Ronald Reagan, said.

All of which means there’s good news and bad news for Trump. The good news is that he has a pathway for potentially protecting himself and the members of his inner circle that Mueller and his team haven’t yet gotten to. The bad news is that he might not be able to do very much for the ones Mueller has already indicted — or any that Mueller indicts between now and the grimly historic day when Trump fires him.

Mueller can be fired. It’s not clear if his team could be too.

Justice Department regulations say that Mueller can’t be fired without a good reason, but they don’t say anything about what would happen to his team of lawyers if he’s fired. Mueller currently has at least 17 people working with him on his investigation, including Andrew Weissmann, an expert on fraud, and Andrew Goldstein, an expert in corruption cases. Most joined the team from other parts of the government — more on that later — while four came in from the private sector, including several who worked with Mueller at the top-shelf law firm WilmerHale.

Mueller’s team was created because of concerns about the Justice Department’s independence. Attorney General Jeff Sessions recused himself from overseeing the investigation into potential collusion between the Trump campaign and Russia due to undisclosed talks with Russia’s ambassador to the US, pushing control of the probe to his deputy, Rosenstein. Trump then fired FBI Director James Comey, who was leading the overall investigation. Rosenstein picked Mueller to carry on the work Comey had been doing.

Trump has never forgiven Sessions for recusing himself from Russia matters, openly criticizing him for allowing the Russia probe to continue and privately discussing replacements. There’s no sign the president is getting ready to fire Sessions, but if he did — and chose a new attorney general with no Russia conflicts — the move would at least theoretically eliminate part of the justification for the continued existence of Mueller’s team.

“You could imagine that attorney general saying, ‘Oh, we don’t need a special counsel or a special counsel staff,’” Miriam Baer, a former federal prosecutor who’s currently teaching at Yale Law School, told me.

Once the special counsel’s team was disbanded, there would be no specific reason the Justice Department would be required to keep investigating. Although most of Mueller’s team normally works elsewhere in the agency, they would have to go back to their old jobs and responsibilities.

So Trump could fire Rosenstein, get someone to fire Mueller, and then eliminate Mueller’s team. But that still doesn’t mean the whole thing would go away. Mueller has already filed charges against Manafort and reached deals with Manafort’s deputy Rick Gates and former National Security Adviser Michael Flynn, and those won’t magically disappear until a judge wants them to.

Mueller’s existing indictments and plea deals would survive

Mueller’s investigation has led to the indictment of Manafort, the former Trump campaign chief, and gotten guilty pleas from Flynn, Gates and George Papadopoulos, a former campaign staffer (all three men are actively cooperating with the Mueller probe). Mueller has also indicted 13 Russian individuals who allegedly tried to swing the election, though there is no chance they’ll ever see the inside of an American courtroom.

Those cases are no longer entirely in Mueller’s hands. That’s because the indictments come from a grand jury, a special panel put together to hear evidence and issue subpoenas and other court orders. And once it’s in the hands of the grand jury, it’s a lot harder to get those cases to just disappear even if Trump fires Mueller.

“It’s the grand jury’s indictment, [so] you can’t just abandon the case,” said Baer, the former federal prosecutor.

If Trump got rid of Mueller and his team, Justice Department officials could instruct lawyers still left at the agency to try to have those indictments killed, but it’s not just their decision. The judges in the courts where the indictments were filed would have to agree.

Given the interest in these cases, and the extensive detail in the indictments drawn up by Mueller, there would be enormous public pressure for the judges to keep the indictments in place.

“[Justice Department lawyers would] have to make a motion to dismiss, and I don’t know how many judges would be inclined to grant it,” Loyola’s Levenson said.

Similarly, a judge would have to sign off if Justice Department lawyers tried to undo the five guilty pleas Mueller has negotiated.

That doesn’t mean that Trump can’t get rid of the court cases. As president, he has near absolute power to issue pardons. If he preemptively pardoned Manafort before his trial, and pardoned those who have struck plea deals, it would wipe out all of Mueller’s work with the grand jury.

Of course, this entire hypothetical situation where Trump tries to end the investigation completely ignores the political realities of what could happen if Trump fired Mueller.

“At that point, I think we’d be dealing much more with a political crisis than a legal crisis,” Levenson said.

It would be the second time Trump had gotten rid of a senior law enforcement official who was looking into his ties with Russia, after firing Comey. Republican lawmakers have been warning Trump about interfering with Mueller, and firing the special counsel could bolster the argument that Trump was attempting to obstruct justice, one of the charges used to impeach Bill Clinton.

“If he tried to do that [remove Mueller], that would be the beginning of the end of his presidency,” Sen. Lindsey Graham (R-SC) told CNN.

Trump’s and his allies have spent months attacking the credibility of the Mueller probe, a move widely seen as setting the stage for firing the special counsel. Despite their tough talk, Republican leaders have made no real efforts to shield Mueller, and legislation designed to protect him from Trump hasn’t gone anywhere. That means Mueller’s future is in the president’s hands. It also means Trump’s future may hinge on what he chooses to do.