WASHINGTON — A federal judge in Virginia sharply challenged on Friday the special counsel’s case against Paul Manafort, suggesting that prosecutors had pursued fraud charges in hopes of gaining evidence that might incriminate President Trump or even topple him from office.

“You don’t really care about Mr. Manafort’s bank fraud,” Judge T. S. Ellis III said during a court hearing in Alexandria. “You really care about getting information that Mr. Manafort can give you that would reflect on Mr. Trump and lead to his prosecution or impeachment or whatever.”

Mr. Trump immediately seized upon the judge’s comments as proof that the special counsel, Robert S. Mueller III, is out of control. In a speech on Friday afternoon to the National Rifle Association in Dallas, he cited the judge’s critique. “I’ve been saying that for a long time,” he said. “It’s a witch hunt.”

He described the judge as “very special” and “highly respected,” and Mr. Manafort, who served as his campaign chairman for five months, as “a good person” who worked for him only briefly.