WASHINGTON — The White House counsel, Don McGahn, has cooperated extensively in the special counsel investigation, sharing detailed accounts about the episodes at the heart of the inquiry into whether President Donald Trump obstructed justice, including some that investigators would not have learned of otherwise, according to a dozen current and former White House officials and others briefed on the matter.

In at least three voluntary interviews with investigators that totaled 30 hours during the past nine months, McGahn described the president’s furor toward the Russia investigation and the ways in which he urged McGahn to respond to it. He provided the investigators examining whether Trump obstructed justice a clear view of the president’s most intimate moments with his lawyer.

Among them were Trump’s comments and actions during the firing of former FBI Director James Comey and Trump’s obsession with putting a loyalist in charge of the inquiry, including his repeated urging of Attorney General Jeff Sessions to claim oversight of it. McGahn was also centrally involved in Trump’s attempts to fire the special counsel, Robert Mueller, which investigators might not have discovered without him.

For a lawyer to share so much with investigators scrutinizing his client is unusual.

Lawyers are rarely so open with investigators, not only because they are advocating on behalf of their clients but also because their conversations with clients are potentially shielded by attorney-client privilege, and in the case of presidents, executive privilege.

“A prosecutor would kill for that,” said Solomon Wisenberg, a deputy independent counsel in the Whitewater investigation, which did not have the same level of cooperation from President Bill Clinton’s lawyers. “Oh my God, it would have been phenomenally helpful to us. It would have been like having the keys to the kingdom.”

McGahn’s cooperation began in part as a result of a decision by Trump’s first team of criminal lawyers to collaborate fully with Mueller. The president’s lawyers have explained that they believed their client had nothing to hide and that they could bring the investigation to an end quickly.

McGahn and his lawyer, William Burck, could not understand why Trump was so willing to allow McGahn to speak freely to the special counsel and feared Trump was setting up McGahn to take the blame for any possible illegal acts of obstruction, according to people close to him. So he and Burck devised their own strategy to do as much as possible to cooperate with Mueller to demonstrate that McGahn did nothing wrong.

It is not clear that Trump appreciates the extent to which McGahn has cooperated with the special counsel. The president wrongly believed that McGahn would act as a personal lawyer would for clients and solely defend his interests to investigators, according to a person with knowledge of his thinking.

In fact, McGahn laid out how Trump tried to ensure control of the investigation, giving investigators a mix of information both potentially damaging and favorable to the president. McGahn cautioned to investigators that he never saw Trump go beyond his legal authorities, though the limits of executive power are murky.

McGahn’s role as a cooperating witness further strains his already complicated relationship with the president. Though Trump has fought with McGahn as much as with any of his top aides, White House advisers have said, both men have benefited significantly from their partnership.

McGahn has overseen two of Trump’s signature accomplishments — stocking the federal courts and cutting government regulations — and become a champion of conservatives in the process.

But the two rarely speak one-on-one — White House Chief of Staff John Kelly and other advisers are usually present for their meetings — and Trump has questioned McGahn’s loyalty. In turn, Trump’s behavior has so exasperated McGahn that he has called the president “King Kong” behind his back, to connote his volcanic anger, people close to McGahn said.

This account is based on interviews with current and former White House officials and others who have spoken to both men, all of whom requested anonymity to discuss a sensitive investigation. A spokesman for the special counsel’s office also declined to comment for this article.

Burck said McGahn had been obliged to cooperate with the special counsel.

“President Trump, through counsel, declined to assert any privilege over Mr. McGahn’s testimony, so Mr. McGahn answered the special counsel team’s questions fulsomely and honestly, as any person interviewed by federal investigators must,” he said.

Asked for comment, the White House sought to quell the sense of tension.

“The president and Don have a great relationship,” the White House press secretary, Sarah Huckabee Sanders, said in a statement. “He appreciates all the hard work he’s done, particularly his help and expertise with the judges, and the Supreme Court” nominees.

The president stressed that the White House had been cooperative with the investigation, tweeting Saturday evening after this article was published that McGahn had been allowed to speak to the special counsel.

McGahn’s route from top White House lawyer to a central witness in the obstruction investigation of the president began around the time Mueller took over the investigation into whether any Trump associates conspired with Russia’s interference in the presidential election.

When Mueller was appointed in May 2017, the lawyers surrounding the president realigned themselves. McGahn and other White House lawyers stopped dealing on a day-to-day basis with the investigation, as they realized they were potential witnesses in an obstruction case.

In the following weeks, Trump assembled a personal legal team to defend him. He wanted to take on Mueller directly, attacking his credibility and impeding investigators. But two of his newly hired lawyers, John Dowd and Ty Cobb, have said they took Trump at his word that he did nothing wrong and sold him on an open-book strategy. As long as Trump and the White House cooperated with Mueller, they told him, they could bring an end to the investigation within months.
McGahn, who had objected to Cobb’s hiring, was dubious, according to people he spoke to around that time. As White House counsel, not a personal lawyer, he viewed his role as protector of the presidency, not of Trump. Allowing a special counsel to root around the West Wing could set a precedent harmful to future administrations.

But he had little ability to intervene. His relationship with the president had soured as Trump blamed him for a number of fraught moments in his first months in office, including the chaotic, failed early attempts at a ban on travelers from some majority-Muslim countries and, in particular, the existence of Mueller’s investigation.

The son of a Treasury Department investigator, McGahn, 50, briefly attended the Naval Academy before transferring to Notre Dame, graduating in 1991. He attended Widener University’s Commonwealth Law School in Pennsylvania, then came to Washington and climbed the ranks of the Republican establishment, alternating between private firms and a stint on the Federal Election Commission.

McGahn joined the Trump team as an early hire, said to like the candidate’s outsider position. His lack of a degree from a top law school bothered Trump, but the candidate saw that McGahn was respected by most of his peers, according to veteran party strategists.

Though he was a senior campaign aide, it is not clear whether Mueller’s investigators have questioned McGahn about whether Trump associates coordinated with Russia’s effort to influence the election.

McGahn’s decision to cooperate with the special counsel grew out of Dowd and Cobb’s game plan, now seen as misguided by some close to the president.

In fall 2017, Mueller’s office asked to interview McGahn. To the surprise of the White House Counsel’s Office, Trump and his lawyers signaled that they had no objection, without knowing the extent of what McGahn was going to tell investigators.

McGahn was stunned, as was Burck, whom he had recently hired out of concern that he needed help to stay out of legal jeopardy, according to people close to McGahn. Burck has explained to others that he told White House advisers that they did not appreciate the president’s legal exposure and that it was “insane” that Trump did not fight a McGahn interview in court.

Even if the president did nothing wrong, Burck told White House lawyers, the White House has to understand that a client like Trump probably made politically damaging statements to McGahn as he weighed whether to intervene in the Russia investigation.

Inside the counsel’s office, lawyers feared that on the recommendation of Dowd and Cobb, the White House was handing Mueller detailed instructions to take down the president and setting a troubling precedent for future administrations by giving up executive privilege.

At the same time, Trump was blaming McGahn for his legal woes, yet encouraging him to speak to investigators. McGahn and his lawyer grew suspicious. They began telling associates that they had concluded that the president had decided to let McGahn take the fall for decisions that could be construed as obstruction of justice, like Comey’s firing, by telling the special counsel that he was only following shoddy legal advice from McGahn.

Worried that Trump would ultimately blame him in the inquiry, McGahn told people he was determined to avoid the fate of the White House counsel for President Richard Nixon, John Dean, who pleaded guilty to conspiracy to obstruct justice in the Watergate scandal.

McGahn decided to fully cooperate with Mueller. It was, he believed, the only choice he had to protect himself.

“This sure has echoes of Richard Nixon’s White House counsel, John Dean, who in 1973 feared that Nixon was setting him up as a fall guy for Watergate and secretly gave investigators crucial help while still in his job,” historian Michael Beschloss said.

Trump’s lawyers still had a chance to keep McGahn’s insider knowledge from the special counsel. By exerting attorney-client privilege, which allows the president to legally withhold information, they would have gained the right to learn what McGahn planned to tell investigators and what he might reveal that could damage the president. But the president’s lawyers never went through that process, although they told people that they believed they still had the ability to stop Mueller from handing over to Congress the accounts of witnesses like McGahn and others.

Mueller has told the president’s lawyers that he will follow Justice Department guidance that sitting presidents cannot be indicted. Rather than charge Trump if he finds evidence of wrongdoing, he is more likely to write a report that can be sent to Congress for lawmakers to consider impeachment proceedings.

Unencumbered, Burck and McGahn met the special counsel team in November for the first time and shared all that McGahn knew.

To investigators, McGahn was a fruitful witness, people familiar with the investigation said. He had been directly involved in nearly every episode they are scrutinizing to determine whether the president obstructed justice. To make an obstruction case, prosecutors who lack a piece of slam-dunk evidence generally point to a range of actions that prove that the suspect tried to interfere with the inquiry.

McGahn gave Mueller’s investigators, the people said: a sense of the president’s mindset in the days leading to the firing of Comey; how the White House handled the firing of former national security adviser Michael Flynn; and how Trump repeatedly berated Sessions, tried to get him to assert control over the investigation and threatened to fire him.

Despite the insistence of Trump’s lawyers that cooperation would help end the inquiry, the investigation only intensified as 2017 came to a close. Mueller had charged Trump’s former campaign chairman and his deputy and won guilty pleas and cooperation agreements from his first national security adviser and a campaign adviser.

Dowd said that cooperation was the right approach but that Mueller had “snookered” Trump’s legal team. The White House has handed over more than 1 million documents and allowed more than two dozen administration officials to meet with Mueller in the belief that he would be forced to conclude there was no obstruction case.

“It was an extraordinary cooperation — more cooperation than in any major case — no president has ever been more cooperative than this,” Dowd said, adding that Mueller knew as far back as October, when he received many White House documents, that the president did not break the law.

As the months passed, it became apparent that McGahn and Burck had overestimated the amount of thought that they believed the president put into his legal strategy. Rather than placing the blame on McGahn for possible acts of obstruction, Trump has yet to even meet with the special counsel, his lawyers resisting an invitation for an interview. McGahn is still the White House counsel, shepherding the president’s second Supreme Court nominee, Brett Kavanaugh, through the confirmation process.

Mueller, armed with McGahn’s account, is still trying to interview witnesses close to the president. But the White House has a new lawyer for the investigation, Emmet Flood, who has strong views on executive privilege issues. When the special counsel asked to interview John Kelly, Flood contested the request, rather than fully cooperate.