“I’ve chosen to stay out of it. But I had the right to, as you know, I had the right if I wanted to to end everything,” he added. “I could’ve just said, ‘That’s enough.’ Many people thought that’s what I should do.”

Mr. Trump’s remarks came days after Mr. Whitaker told reporters that he believed the inquiry was nearing its end.

“The investigation is, I think, close to being completed, and I hope that we can get the report from Director Mueller as soon as possible,” Mr. Whitaker said at the end of a news conference about an unrelated case.

Since the special counsel was appointed in May 2017, it has been rare for senior Justice Department officials to comment publicly about the Russia inquiry.

Under Justice Department rules, Mr. Mueller must explain his prosecutorial decisions in a “confidential report” to the attorney general once his investigation has ended. The attorney general must in turn send a report to Congress indicating why the work has been completed, though that can consist of only a brief summary.