PRESIDENT TRUMP’S Wednesday firing of Attorney General Jeff Sessions was not surprising, but it should still be shocking. Mr. Sessions’s sin was not that he was insufficiently wedded to the president’s agenda; indeed, the attorney general was perhaps the most effective member of the Cabinet in advancing Trumpist policies. Rather, the president complained that Mr. Sessions failed to protect him, as a hired lawyer protects a private client, from legitimate law enforcement inquiries.

Mr. Sessions’s performance as attorney general was far from praiseworthy. But at some crucial moments, such as when he properly recused himself from the Russia investigation, he showed a fidelity to the independence and integrity of the Justice Department, and it was for that essential loyalty that the president could not tolerate him.

The Justice Department is now in peril. Mr. Trump has made clear he wants a lapdog running the nation’s law enforcement apparatus. Some of the people previously mentioned as possible replacements for Mr. Sessions — such as former New York mayor Rudolph W. Giuliani or former Environmental Protection Agency administrator Scott Pruitt — practically embody cravenness. Mr. Trump’s new acting attorney general, Matthew Whitaker, has expressed hostile views about the Russia investigation run by special counsel Robert S. Mueller III.

These facts are all the more chilling as the president threatens to investigate House Democrats in retaliation for any investigations of the Trump administration they might mount. Congress is supposed to conduct oversight. The Justice Department is supposed to prosecute criminals, not serve as a private presidential hit squad.

No matter whom Mr. Trump chooses, the Senate must ensure that he or she will serve as a duty-bound professional. Prominent GOP voices on law enforcement matters, such as Senate Judiciary Committee Chairman Charles E. Grassley (Iowa), have previously insisted that the attorney general protect the independence of the Justice Department from presidents who would misuse its awesome powers. Now is the time for them to deliver on those words.

That applies especially to the Mueller investigation and any other legal inquiries that may touch on the president. Mr. Trump indicated in a Wednesday news conference that he did not want to end the probe. But, short of stopping it, Mr. Sessions’s successor could drain it of resources or move to cover up its findings.

As the American Civil Liberties Union argued Wednesday , “ The Senate must demand that any nominee for attorney general must commit to not interfere in the special counsel investigation, and continue to have Robert Mueller operate under the special counsel regulation.”