Mr. McGahn disagreed with the president’s case and told senior White House officials that firing Mr. Mueller would have a catastrophic effect on Mr. Trump’s presidency. Mr. McGahn also told White House officials that Mr. Trump would not follow through on the dismissal on his own. The president then backed off.
Ty Cobb, who manages the White House’s relationship with Mr. Mueller’s office, said in a statement, “We decline to comment out of respect for the Office of the Special Counsel and its process.”
Mr. McGahn, a longtime Republican campaign finance lawyer in Washington who served on the Federal Election Commission, was the top lawyer on Mr. Trump’s campaign. He has been involved in nearly every key decision Mr. Trump has made — like the firing of the former F.B.I. director — that is being scrutinized by Mr. Mueller.
Mr. McGahn was also concerned that firing the special counsel would incite more questions about whether the White House was trying to obstruct the Russia investigation.
Around the time Mr. Trump wanted to fire Mr. Mueller, the president’s legal team, led then by his longtime personal lawyer in New York, Marc E. Kasowitz, was taking an adversarial approach to the Russia investigation. The president’s lawyers were digging into potential conflict-of-interest issues for Mr. Mueller and his team, according to current and former White House officials, and news media reports revealed that several of Mr. Mueller’s prosecutors had donated to Democrats.
Mr. Mueller could not legally have considered political affiliations when making hiring decisions. But for Mr. Trump’s supporters, it reinforced the idea that, although Mr. Mueller is a Republican, he had assembled a team of Democrats to take down the president.
Another option that Mr. Trump considered in discussions with his advisers was dismissing the deputy attorney general, Rod J. Rosenstein, and elevating the department’s No. 3 official, Rachel Brand, to oversee Mr. Mueller. Mr. Rosenstein has overseen the investigation since March, when Attorney General Jeff Sessions recused himself.
Mr. Trump has significantly ratcheted back his criticisms of Mr. Mueller since he hired Mr. Cobb for his legal team in July. A veteran of several high-profile Washington controversies, Mr. Cobb has known Mr. Mueller for decades, dating to their early careers in the Justice Department.
He advised Mr. Trump that he had nothing to gain from combat with Mr. Mueller, a highly respected former prosecutor and F.B.I. director who has subpoena power as special counsel. Since Mr. Cobb’s arrival, the White House has operated on the premise that the quickest way to clear the cloud of suspicion was to cooperate with Mr. Mueller, not to fight him.
Nonetheless, Mr. Trump has wavered for months about whether he wants to fire Mr. Mueller, whose job security is an omnipresent concern among the president’s legal team and close aides. The president’s lawyers, including Mr. Cobb, have tried to keep Mr. Trump calm by assuring him for months, amid new revelations about the inquiry, that it is close to ending.
Mr. Trump has long demonstrated a preoccupation with those who have overseen the Russia investigation. In March, after Mr. McGahn failed to persuade Attorney General Jeff Sessions not to recuse himself from the inquiry, Mr. Trump complained that he needed someone loyal to oversee the Justice Department.
The former F.B.I. director, James B. Comey, said Mr. Trump asked him for loyalty and encouraged him to drop an investigation into his former national security adviser, Michael T. Flynn. Mr. Comey said he sidestepped those requests. He was soon fired.
In an interview with The New York Times in the Oval Office in July, the president pointedly kept open the option of firing Mr. Mueller, saying that the special counsel would be passing a red line if his investigation expanded to look at Mr. Trump’s finances. Mr. Trump said he never would have made Mr. Sessions the attorney general if he had known he would recuse himself from the investigation.
Last month, as Republicans were increasing their attacks on the special counsel, Mr. Trump said in an interview with The Times that he believed Mr. Mueller was going to treat him fairly.
“No, it doesn’t bother me because I hope that he’s going to be fair,” Mr. Trump said in response to a question about whether it bothered him that Mr. Mueller had not yet ended his investigation. “I think that he’s going to be fair.”
Mr. Trump added: “There’s been no collusion. But I think he’s going to be fair.”