WASHINGTON — President Trump gave firm instructions in March to the White House’s top lawyer: stop the attorney general, Jeff Sessions, from recusing himself in the Justice Department’s investigation into whether Mr. Trump’s associates had helped a Russian campaign to disrupt the 2016 election.

Public pressure was building for Mr. Sessions, who had been a senior member of the Trump campaign, to step aside. But the White House counsel, Donald F. McGahn II, carried out the president’s orders and lobbied Mr. Sessions to remain in charge of the inquiry, according to two people with knowledge of the episode.

Mr. McGahn was unsuccessful, and the president erupted in anger in front of numerous White House officials, saying he needed his attorney general to protect him. Mr. Trump said he had expected his top law enforcement official to safeguard him the way he believed Robert F. Kennedy, as attorney general, had done for his brother John F. Kennedy and Eric H. Holder Jr. had for Barack Obama.

Mr. Trump then asked, “Where’s my Roy Cohn?” He was referring to his former personal lawyer and fixer, who had been Senator Joseph R. McCarthy’s top aide during the investigations into communist activity in the 1950s and died in 1986.

The lobbying of Mr. Sessions is one of several previously unreported episodes that the special counsel, Robert S. Mueller III, has learned about as he investigates whether Mr. Trump obstructed the F.B.I.’s Russia inquiry. The events occurred during a two-month period — from when Mr. Sessions recused himself in March until the appointment of Mr. Mueller in May — when Mr. Trump believed he was losing control over the investigation.

Image

Legal experts said that of the two primary issues that the special counsel, Robert S. Mueller III, appears to be investigating — whether Mr. Trump obstructed justice while in office and whether there was collusion between the Trump campaign and Russia — there is currently a larger body of public evidence tying the president to a possible crime of obstruction.CreditDoug Mills/The New York Times

Among the other episodes, Mr. Trump described the Russia investigation as “fabricated and politically motivated” in a letter that he intended to send to the F.B.I. director at the time, James B. Comey, but that White House aides stopped him from sending. Mr. Mueller has also substantiated claims that Mr. Comey made in a series of memos describing troubling interactions with the president before he was fired in May.

The special counsel has received handwritten notes from Mr. Trump’s former chief of staff, Reince Priebus, showing that Mr. Trump talked to Mr. Priebus about how he had called Mr. Comey to urge him to say publicly that he was not under investigation. The president’s determination to fire Mr. Comey even led one White House lawyer to take the extraordinary step of misleading Mr. Trump about whether he had the authority to remove him.

The New York Times has also learned that four days before Mr. Comey was fired, one of Mr. Sessions’s aides asked a congressional staff member whether he had damaging information about Mr. Comey, part of an apparent effort to undermine the F.B.I. director. It was not clear whether Mr. Mueller’s investigators knew about this episode.

Mr. Mueller has also been examining a false statement that the president reportedly dictated on Air Force One in July in response to an article in The Times about a meeting that Trump campaign officials had with Russians in 2016. A new book, “Fire and Fury: Inside the Trump White House,” by Michael Wolff, says that the president’s lawyers believed that the statement was “an explicit attempt to throw sand into the investigation’s gears,” and that it led one of Mr. Trump’s spokesmen to quit because he believed it was obstruction of justice.

Ty Cobb, the White House lawyer dealing with the special counsel’s investigation, declined to comment.

Mr. Trump’s lawyers have said the president has fully cooperated with the investigation, and they have expressed confidence that the inquiry will soon be coming to a close. They said that they believed the president would be exonerated, and that they hoped to have that conclusion made public.

Legal experts said that of the two primary issues Mr. Mueller appears to be investigating — whether Mr. Trump obstructed justice while in office and whether there was collusion between the Trump campaign and Russia — there is currently a larger body of public evidence tying the president to a possible crime of obstruction.

But the experts are divided about whether the accumulated evidence is enough for Mr. Mueller to bring an obstruction case. They said it could be difficult to prove that the president, who has broad authority over the executive branch, including the hiring and firing of officials, had corrupt intentions when he took actions like ousting the F.B.I. director. Some experts said the case would be stronger if there was evidence that the president had told witnesses to lie under oath.

The accounts of the episodes are based on documents reviewed by The Times, as well as interviews with White House officials and others briefed on the investigation. They spoke on the condition of anonymity because they did not want to be identified discussing a continuing investigation.

Regardless of whether Mr. Mueller believes there is enough evidence to make a case against the president, Mr. Trump’s belief that his attorney general should protect him provides an important window into how he governs. Presidents have had close relationships with their attorneys general, but Mr. Trump’s obsession with loyalty is particularly unusual, especially given the Justice Department’s investigation into him and his associates.

A Lawyer’s Gambit

It was late February when Mr. Sessions decided to take the advice of career Justice Department lawyers and recuse himself from the Russia investigation.

The pressure to make that decision public grew days later when The Washington Post reported that Mr. Sessions had met during the presidential campaign with Russia’s ambassador to the United States. The disclosure raised questions about whether Mr. Sessions had misled Congress weeks earlier during his confirmation hearing, when he told lawmakers he had not met with Russians during the campaign.

Image

Donald F. McGahn II, the White House counsel, argued to Mr. Sessions that he did not need to recuse himself from the Russia investigation until it was further along.CreditAl Drago/The New York Times

Unaware that Mr. Sessions had already decided to step aside from the inquiry, Democrats began calling for Mr. Sessions to recuse himself — and Mr. Trump told Mr. McGahn to begin a lobbying campaign to stop him.

Mr. McGahn’s argument to Mr. Sessions that day was twofold: that he did not need to step aside from the inquiry until it was further along, and that recusing himself would not stop Democrats from saying he had lied. After Mr. Sessions told Mr. McGahn that career Justice Department officials had said he should step aside, Mr. McGahn said he understood and backed down.

Mr. Trump’s frustrations with the inquiry erupted again about three weeks later, when Mr. Comey said publicly for the first time that the Justice Department and the F.B.I. were conducting an investigation into links between Mr. Trump’s campaign and Russia. Mr. Comey had told Mr. Trump in private that he was not personally under investigation, yet Mr. Comey infuriated Mr. Trump by refusing to answer a question about that at the hearing where he spoke publicly.

After that hearing, Mr. Trump began to discuss openly with White House officials his desire to fire Mr. Comey. This unnerved some inside the White House counsel’s office, and even led one of Mr. McGahn’s deputies to mislead the president about his authority to fire the F.B.I. director.

The lawyer, Uttam Dhillon, was convinced that if Mr. Comey was fired, the Trump presidency could be imperiled, because it would force the Justice Department to open an investigation into whether Mr. Trump was trying to derail the Russia investigation.

Longstanding analysis of presidential power says that the president, as the head of the executive branch, does not need grounds to fire the F.B.I. director. Mr. Dhillon, a veteran Justice Department lawyer before joining the Trump White House, assigned a junior lawyer to examine this issue. That lawyer determined that the F.B.I. director was no different than any other employee in the executive branch, and that there was nothing prohibiting the president from firing him.

Image

James B. Comey, the F.B.I. director, refused to answer questions from lawmakers about whether Mr. Trump was under investigation during a Senate Judiciary Committee hearing in May.CreditGabriella Demczuk for The New York Times

But Mr. Dhillon, who had earlier told Mr. Trump that he needed cause to fire Mr. Comey, never corrected the record, withholding the conclusions of his research.

Stephen I. Vladeck, a law professor at the University of Texas School of Law, called the episode “extraordinary,” adding that he could not think of a similar one that occurred in past administrations.

“This shows that the president’s lawyers don’t trust giving him all the facts because they fear he will make a decision that is not best suited for him,” Mr. Vladeck said.

Searching for Dirt

The attempts to stop Mr. Trump from firing Mr. Comey were successful until May 3, when the F.B.I. director once again testified on Capitol Hill. He spent much of the time describing a series of decisions he had made during the bureau’s investigation into Hillary Clinton’s personal email account.

Once again, Mr. Comey refused to answer questions from lawmakers about whether Mr. Trump was under investigation.

White House aides gave updates to Mr. Trump throughout, informing him of Mr. Comey’s refusal to publicly clear him. Mr. Trump unloaded on Mr. Sessions, who was at the White House that day. He criticized him for recusing himself from the Russia investigation, questioned his loyalty, and said he wanted to get rid of Mr. Comey. He repeated the refrain that the attorneys general for Mr. Kennedy and Mr. Obama had protected the White House.

Image

Mr. Trump criticized Mr. Sessions for recusing himself from the Russia investigation and questioned his loyalty.CreditDoug Mills/The New York Times

“When you look at the I.R.S. scandal, when you look at the guns for whatever, when you look at all of the tremendous, aah, real problems they had, not made-up problems like Russian collusion, these were real problems,” Mr. Trump said. “When you look at the things that they did, and Holder protected the president. And I have great respect for that, I’ll be honest.”

Two days after Mr. Comey’s testimony, an aide to Mr. Sessions approached a Capitol Hill staff member asking whether the staffer had any derogatory information about the F.B.I. director. The attorney general wanted one negative article a day in the news media about Mr. Comey, according to a person with knowledge of the meeting.

A Justice Department spokeswoman said the episode did not occur. “This did not happen and would not happen,” said the spokeswoman, Sarah Isgur Flores. “Plain and simple.”

Earlier that day, Rod J. Rosenstein, the deputy attorney general, had pulled one of Mr. McGahn’s deputies aside after a meeting at the Justice Department. Mr. Rosenstein told the aide that top White House and Justice Department lawyers needed to discuss Mr. Comey’s future. It is unclear whether this conversation was related to the effort to dig up dirt on Mr. Comey.

Mr. Trump spent the next weekend at his country club in Bedminster, N.J., where he watched a recording of Mr. Comey’s testimony, stewed about the F.B.I. director and discussed the possibility of dismissing him with his son-in-law, Jared Kushner, and his senior policy adviser, Stephen Miller. He had decided he would fire Mr. Comey, and asked Mr. Miller to help put together a letter the president intended to send to Mr. Comey.

In interviews with The Times, White House officials have said the letter contained no references to Russia or the F.B.I.’s investigation. According to two people who have read it, however, the letter’s first sentence said the Russia investigation had been “fabricated and politically motivated.”

On Monday, May 8, Mr. Trump met with Mr. Sessions and Mr. Rosenstein to discuss firing Mr. Comey, and Mr. Rosenstein agreed to write his own memo outlining why Mr. Comey should be fired. Before writing it, he took a copy of the letter that Mr. Trump and Mr. Miller had drafted during the weekend in Bedminster.

The president fired Mr. Comey the following day.

A week later, The Times reported that Mr. Trump had asked Mr. Comey in February to shut down the federal investigation into Michael T. Flynn, who at the time was the national security adviser. The following day, Mr. Rosenstein announced that he had appointed Mr. Mueller as special counsel.

Once again, Mr. Trump erupted at Mr. Sessions upon hearing the news. In an Oval Office meeting, the president said the attorney general had been disloyal for recusing himself from the Russia investigation, and he told Mr. Sessions to resign.

Mr. Sessions sent his resignation letter to the president the following day. But Mr. Trump rejected it, sending it back with a handwritten note at the top.

“Not accepted,” the note said.

Matt Apuzzo and Julie Hirschfeld Davis contributed reporting from Washington, and Maggie Haberman from New York.

A version of this article appears in print on , on Page A1 of the New York edition with the headline: Trump Expected Sessions to Keep Leash on Inquiry. Order Reprints | Today’s Paper | Subscribe