“Attorney General Sessions carrying a resignation letter with him each time he had a meeting at the White House is a vivid reflection of the dysfunctional and unprecedented approach this president has taken towards the Department of Justice and federal law enforcement,” said Matthew S. Axelrod, a partner at Linklaters and a former Justice Department official and prosecutor under Mr. Bush and President Barack Obama.

Mr. Sessions resisted multiple entreaties to reverse his recusal so he could oversee and curtail the Mueller inquiry; by the time the criminal investigation of him ended in March 2018, he could do little to get back in the president’s graces.

Mr. Rosenstein, whose office received briefings every other week on the progress of the investigation, would have glimpsed the gravity of the situation as the special counsel interviewed witnesses.

He was also in the unusual position of being a witness himself in the investigation that he oversaw. Critics have said that role should have prompted Mr. Rosenstein to recuse himself from the inquiry, but top ethics lawyers at the Justice Department cleared him to oversee the special counsel, a department spokeswoman said. She added that the special counsel’s office never asked about or questioned that decision.

After Mr. Trump fired Mr. Comey as the director of the F.B.I., setting off a storm of criticism, he asked Mr. Rosenstein to give a news conference and say that the firing had been his idea.

Mr. Rosenstein warned the president that the news conference was a bad idea “because if the press asked him, he would tell the truth,” Mr. Mueller’s investigators wrote. Mr. Sessions told White House lawyers that Mr. Rosenstein was upset about being used as a pretext for the ouster, and both officials told Donald F. McGahn II, then the White House counsel, that Mr. Trump was spinning a false narrative about Mr. Rosenstein’s role in the termination.

Mr. Rosenstein proved to be deeply rattled during the chaotic days after Mr. Comey’s firing. He discussed the possibility of invoking the 25th Amendment to remove Mr. Trump as president and suggested that he secretly record Mr. Trump in the Oval Office, according to people briefed on the events. Mr. Rosenstein has denied their accounts.