WASHINGTON — Attorney General Jeff Sessions was questioned for several hours last week as part of the special counsel investigation, the Justice Department confirmed Tuesday, making him the first member of President Trump’s cabinet to be interviewed in the inquiry.

The interview occurred as the special counsel, Robert S. Mueller III, is increasingly focused on Mr. Trump’s conduct in office and on whether he obstructed the investigation itself, according to two people briefed on the matter. In recent weeks, Mr. Mueller has told the president’s lawyers that he will most likely want to interview Mr. Trump about the firing of the F.B.I. director, James B. Comey, and about the former national security adviser, Michael T. Flynn, one of the people said. Mr. Mueller’s investigators have asked current and former Trump administration officials about what Mr. Trump cited as reasons for Mr. Comey’s firing, and why Mr. Trump was so concerned about having someone loyal to him oversee the Russia investigation, people familiar with the interviews said.

For Mr. Sessions, the interview was the latest in a balancing act that has lasted nearly a year. He has sought to get back in Mr. Trump’s good graces by pursuing investigations into issues like leaks to the news media and relaying Mr. Trump’s displeasure about senior F.B.I. leadership to the bureau’s current director, Christopher A. Wray.

But Mr. Sessions has also tried to present a veneer of independence in congressional testimony and now has met with investigators in Mr. Mueller’s inquiry, which has for months cast a shadow over the Trump White House.