WASHINGTON — The day after President Trump asked James B. Comey, the F.B.I. director, to end an investigation into his former national security adviser, Mr. Comey confronted Attorney General Jeff Sessions and said he did not want to be left alone again with the president, according to current and former law enforcement officials.

Mr. Comey believed Mr. Sessions should protect the F.B.I. from White House influence, the officials said, and pulled him aside after a meeting in February to tell him that private interactions between the F.B.I. director and the president were inappropriate. But Mr. Sessions could not guarantee that the president would not try to talk to Mr. Comey alone again, the officials said.

Mr. Comey did not reveal, however, what had so unnerved him about his Oval Office meeting with the president: Mr. Trump’s request that the F.B.I. director end the investigation into the former national security adviser, Michael T. Flynn, who had just been fired. By the time Mr. Trump fired Mr. Comey last month, Mr. Comey had disclosed the meeting to a few of his closest advisers but nobody at the Justice Department, according to the officials, who did not want to be identified discussing Mr. Comey’s interactions with Mr. Trump and Mr. Sessions.

Mr. Comey will be the center of attention on Thursday during testimony before the Senate Intelligence Committee, where he is expected to be quizzed intensely about his interactions with Mr. Trump and why he decided to keep secret the president’s request to end the Flynn investigation.