A bipartisan pair of senators has introduced a bill aimed at protecting Robert Mueller, the special counsel overseeing the investigation into Russian meddling in the 2016 election, should President Trump decide to fire him.

The bill, introduced Thursday by Sens. Thom Tillis, R-N.C., and Chris Coons, D-Del., would allow a special counsel who is removed to challenge the firing in court. There, a three-judge panel would decide whether the special counsel's removal was justified. If the judges decide there was no good cause for firing, the person would be reinstated as special counsel over the wishes of the president.

If passed in its current form, the law would be retroactively effective as of May 17, 2017 — the day Deputy Attorney General Rod Rosenstein appointed Mueller to serve as special counsel in the Russia probe.

"It is critical that special counsels have the independence and resources they need to lead investigations," Tillis said in a statement. "A back-end judicial review process to prevent unmerited removals of special counsels not only helps to ensure their investigatory independence, but also reaffirms our nation's system of checks and balances."

Mueller was tapped to oversee the Justice Department's investigation after President Trump unexpectedly fired former FBI Director James Comey. Since he took over the probe, Mueller has hired more than a dozen lawyers to help investigate ties between Trump campaign associates and Russian officials.

The president has often criticized Mueller, a former FBI director, and the team he assembled. Trump has complained about the political contributions some lawyers on the team have made to Democrats, including Hillary Clinton, and the president has inquired privately about his ability to fire Mueller, according to reports.

In an interview with the New York Times last month, Trump warned Mueller to stay out of his family's finances, and said it would cross a line if the former FBI director expanded the investigation to include their finances, beyond a relationship to Russia.

"I think that's a violation," Trump said. "Look, this is about Russia."

Despite Trump's criticisms, Republicans and Democrats have warned the president not to fire Mueller.

"Ensuring that the special counsel cannot be removed improperly is critical to the integrity of his investigation," Coons said in a statement.

In addition to allowing judicial review should a special counsel be removed, the bill from Coons and Tillis would also codify existing Justice Department regulations stating that a special counsel can only be fired for misconduct, dereliction of duty, incapacity, conflict of interest, or other "good cause."

The bill gives the attorney general, or the senior most Justice Department official in charge should the attorney general be recused from the matter, the power to remove or discipline a special counsel.

Because Attorney General Jeff Sessions recused himself from the Russia investigation, Rosenstein is in charge.