A months-long examination of the intelligence war in Ukraine draws on a trove of sensitive materials including intercepted communications involving Russian intelligence operatives, as well as in-depth interviews with senior Ukrainian, U.S. and European officials. Here are some key findings:

1. A clandestine branch of Russia’s security service was deeply involved in the Kremlin’s failed war plan, assuring officials in Moscow that Ukraine’s government would fall quickly and deploying operatives to install a puppet regime.

The FSB branch, known internally as the Department of Operational Information, has for years carried out clandestine operations to penetrate Ukraine’s institutions, pay off pro-Russian politicians and prevent the country from leaving Moscow’s orbit. Despite its intense focus on Ukraine, Western intelligence officials said, the FSB either failed to grasp how fiercely Ukraine would resist, or did understand but couldn’t convey such inconvenient information to Russian President Vladimir Putin.

2. FSB officers were so confident they would seize the levers of power in Kyiv that they spent the final days before the war arranging accommodations in the capital.

Communications intercepted by Ukrainian security services show FSB officers asking colleagues for details about apartments and other locations they might use as safe houses, residences or bases of operation. Days before Russian forces crossed into Ukraine, officials said, FSB informants were told to vacate the capital but leave behind keys to their residences for arriving Russian operatives.

3. The FSB’s Ukraine department underwent a major expansion in the period leading up to the invasion, according to Ukrainian and Western security officials.

The department surged in size from about 30 officers in 2019 to as many as 160 on the eve of the Ukraine invasion, officials said. FSB teams were assigned regions of Ukraine and networks of sleeper agents inside the country. In retrospect, Ukrainian officials see the buildup as an early warning that Russia was laying the groundwork for an attack.

4. The FSB worked closely with prominent collaborators and lined up at least two pro-Russian governments-in-waiting.

The FSB’s main allies included former Ukrainian president Viktor Yanukovych, who fled to Russia in 2014, and Viktor Medvedchuk, an oligarch who became co-leader of Ukraine’s main pro-Russian party after forging a close relationship with Putin. Yanukovych was at the center of a group that assembled in Belarus in early March, possibly positioned to swoop in and reclaim power. A second group involving former members of Yanukovych’s party gathered in territory in southern Ukraine that was seized early in the war by Russian forces.

5. Despite repeated failures, FSB leaders remain in their positions and the agency has regrouped, putting officers on three-month rotations in regions occupied by Russian forces.

U.S. and other officials said they have seen no evidence that Putin has cleaned house at the top of Russia’s spy agencies or held senior officials to account for costly misjudgments. Instead, FSB Director Alexander Bortnikov and the leader of its Ukraine directorate, Sergey Beseda, remain in their positions, overseeing aspects of the war effort.