WASHINGTON — Donald F. McGahn II departed as White House counsel on Wednesday, ending a tumultuous 21-month tenure during which he spearheaded some of President Trump’s most significant political accomplishments, including two appointments to the Supreme Court, but also became a chief witness against him in the special counsel investigation.
Mr. McGahn’s departure was confirmed by two people close to him. Mr. McGahn and the president sat for a farewell chat on Wednesday, one said. Mr. Trump said this week that he would install as Mr. McGahn’s replacement the longtime Washington lawyer Pat Cipollone, calling him “a very fine man, highly respected by a lot of people.”
As White House counsel, Mr. McGahn took on a handful of often-conflicting roles: counselor to the president; protector of top law enforcement officials, including the special counsel, Robert S. Mueller III; and witness in the investigation into whether Mr. Trump obstructed justice. He has told associates that he stopped Mr. Trump from firing Mr. Mueller and from forcing Attorney General Jeff Sessions to retake control of the Russia inquiry after he recused himself from oversight of it.
A longtime fixture in Republican legal circles, Mr. McGahn led White House efforts to slash government regulations and stack the federal courts with conservative judges. He shepherded the nominations of both of Mr. Trump’s Supreme Court choices, Neil M. Gorsuch and Brett M. Kavanaugh.
Mr. McGahn played a pivotal role in keeping Justice Kavanaugh’s nomination on track at one of its most precarious moments, encouraging the nominee to defiantly reject sexual assault allegations against him in a high-stakes hearing before the Senate Judiciary Committee.
But Mr. McGahn had little tolerance for Mr. Trump’s often emotional responses to the legal cloud hanging over his administration, referring to the president as “King Kong” — out of Mr. Trump’s earshot — because of his explosive anger. Mr. McGahn often tried to stop the president from taking steps that Mr. McGahn viewed as legally or politically problematic, such as firing the special counsel. The president blamed Mr. McGahn for the deputy attorney general’s appointment of Mr. Mueller in May 2017, saying Mr. McGahn had not done enough to control the Justice Department.
Mr. McGahn may have also caused more damage for Mr. Trump than any other White House official in the special counsel investigation. Mr. McGahn has spent at least 30 hours with Mr. Mueller’s investigators, laying out how Mr. Trump tried to interfere with or quash the inquiry, including by trying to fire Mr. Mueller himself in the summer of 2017.
Mr. Trump also considered giving the job of White House counsel to Emmet T. Flood, the White House lawyer for the special counsel investigation whom he has grown to trust. Some White House officials told Mr. Flood, who wants to represent the president if impeachment proceedings begin in Congress, that he should have taken the job in order to maintain control over the special counsel investigation and possible impeachment. Mr. Flood ultimately did not take the job, according to people familiar with the discussions, and is expected to remain in his post.
Mr. McGahn had long planned to leave the White House this fall. But in August, shortly after the extent of his witness testimony was revealed by The New York Times, the president surprised Mr. McGahn by announcing on Twitter that he would be leaving as White House counsel after Justice Kavanaugh was confirmed.
Mr. McGahn, 50, graduated from Notre Dame and attended Widener University’s Commonwealth Law School in Pennsylvania before coming to Washington, where he worked in private practice specializing in election law and served on the Federal Election Commission for five years. He joined the Trump campaign in 2015, when Mr. Trump was a long-shot candidate.
Inside the White House, Mr. McGahn was often protected by the chief of staff, John F. Kelly, who created a buffer between Mr. McGahn and the president, according to the president’s advisers. Mr. McGahn also developed a particularly close relationship with the Senate majority leader, Mitch McConnell, whom he worked with closely on judicial nominations even after Mr. McConnell’s relationship with Mr. Trump frayed.