WASHINGTON — President Trump on Saturday unleashed an extended assault on the F.B.I. and the special counsel’s investigation, knitting together a comprehensive alternative story in which he had been framed by disgraced “losers” at the bureau’s highest levels.

In a two-hour span starting at 7 a.m., the president made a series of false claims on Twitter about his adversaries and the events surrounding the inquiry. He was responding to a report in The New York Times that, after he fired James B. Comey as F.B.I. director in 2017, the bureau began investigating whether the president had acted on behalf of Russia.

In his tweets, the president accused Hillary Clinton, without evidence, of breaking the law by lying to the F.B.I. He claimed that Mr. Comey was corrupt and best friends with the special counsel, Robert S. Mueller III. He said Mr. Mueller was employing a team of Democrats — another misleading assertion — bent on taking him down.

Individually, the president’s claims were familiar. But as the special counsel’s inquiry edges ever closer to him, Democrats vow a blizzard of investigations of their own and the government shutdown reaches record lengths, Mr. Trump compiled all the threads of the conspiracy theory he has pushed for many months in an effort to discredit the investigation.