“That is really now in a whole new level of unfairness,” Mr. Trump said of the raids involving Mr. Cohen. Officials said the White House learned about the raids from Mr. Cohen’s lawyer after they were carried out but before they became public knowledge.

Mr. Trump has long complained that the Russia inquiry was a politically motivated attempt to undermine the legitimacy of his election victory. And he has been highly critical of Mr. Sessions and the F.B.I. for failing to adequately investigate Mrs. Clinton’s use of a private email server.

But the aggressive move by federal officials against Mr. Cohen, the president’s longtime personal lawyer, appeared to strike a particularly sensitive nerve. Mr. Cohen, who works for Mr. Trump’s private company, has long been considered one of the president’s closest business confidants.

Mr. Trump reacted to the raids without any prompting from reporters, who had been brought into the Cabinet Room where the president was meeting with Jim Mattis, the secretary of defense; John R. Bolton, the new national security adviser; and other military officials to discuss the situation in Syria. As the cameras began rolling, Mr. Trump immediately condemned the actions against Mr. Cohen.

“So, I just heard that they broke into the office of one of my personal attorneys, a good man, and it’s a disgraceful situation,” he said. “It’s a total witch hunt. I’ve been saying it for a long time. I’ve wanted to keep it down.”

It was unclear what Mr. Trump meant by saying he “wanted to keep it down.” He went on to criticize Mr. Mueller’s team for examining the president’s associates.

“They only keep looking at us. So they find no collusion, and then they go from there and they say, ‘Well, let’s keep going,’ and they raid an office of a personal attorney early in the morning, and I think it’s a disgrace,” Mr. Trump said.