It happened in plain sight: a relentless accumulation of troops, tanks and rockets that took place over nearly four months and was captured by ordinary Russians on their cellphones and dashcams, as well as by commercial and spy satellites.
U.S. President Joe Biden warned as far back as Jan. 19 that Russian President Vladimir Putin would "move in" on Ukraine. By Feb. 18, he was convinced that Putin had decided to invade within days and attack the capital Kyiv.
But frantic diplomacy, sanctions threats and unprecedented U.S.-led "information warfare" proved powerless to prevent what finally unfolded in the early hours of Thursday, as Russia's missiles struck Ukrainian cities and its troops poured across the borders.
Crucially, Putin knew the United States and NATO would not intervene to fight alongside Ukraine. Western leaders had publicly ruled that out, on the grounds that Ukraine is not an alliance member.
"That was the biggest missing piece. The moment you say to Putin that you are not going to fight whatever happens, he has got the upper hand. He was content to take that (sanctions) risk because to him that risk looked calculable," said Jonathan Eyal of the RUSI think-tank in London.
"He didn’t befuddle us, he didn't bamboozle us – we knew what he was up to. The only problem was that we were not prepared to take the ultimate risk."
For weeks, Russia had publicly mocked the increasingly urgent Western warnings that it could invade any time, accusing the United States and its allies of hysteria and war-mongering.
Putin's spokesman said the Kremlin leader had joked about media reports naming dates for the planned invasion, asking aides to let him know what time it would start.
All the time, he was moving closer to pulling the trigger.
The Russian military build-up from November onwards took place exactly in parallel with what Putin presented as a major diplomatic initiative to enforce Russian "red lines" and obtain legally binding security guarantees from the West.
In December, Russia presented demands to the United States and NATO that even analysts close to the Kremlin said Moscow knew would be rejected. They included calls to block Ukraine from ever joining NATO and to remove all military infrastructure the alliance had placed in eastern Europe since 1997.
It was a trap for the West. Engagement with Russia, let alone concessions, would appear to reward it for threatening behaviour; outright rejection of Moscow's demands would be used by Putin as evidence that Russia's opponents had spurned diplomacy and that he had no choice but to take matters into his own hands - exactly the argument that he used this week.
As the Russian military build-up intensified, NATO responded by sending thousands more troops to eastern Europe and supplying Ukraine with weapons including anti-tank missiles. This too was presented by Putin as proof of aggressive Western intent.
The United States saw what was coming, even if it was unsure about the size and scale of a looming Russian attack. Secretary of State Antony Blinken said repeatedly that Russia was following the same military and propaganda "playbook" that it used before seizing Crimea from Ukraine in 2014.
But threats of massive and unprecedented sanctions proved ineffective against a country that has already lived with sanctions for years, has accumulated $635 billion in gold and foreign exchange reserves and supplies a third of Europe's gas.
Even as they ramped up those warnings, Western leaders wondered aloud if they would just bounce off Putin. British Prime Minister Boris Johnson said sanctions "may not be enough to deter an irrational actor".
In a rare and risky move, the United States and Britain released intelligence warnings of "false flag" operations they said Russia planned to conduct. Blinken told the United Nations these could include a real or fake chemical attack for which Russia would pin the blame on Ukraine.
Eyal praised the U.S. intelligence tactics, which he said had likely come as a surprise to Putin and proved effective in exposing his intentions. But he said the failure of the sanctions approach lay in placing a quantifiable ceiling on the costs that Putin would face, instead of keeping him guessing.
"He always had the upper hand in the escalation of this crisis because he knew the maximum he could expect from us. At no point did we succeed in persuading him that our response would be so uncertain that he should not contemplate the operation."
All the while, Putin went through the motions of diplomacy, including two phone calls with Biden and long meetings with the leaders of France and Germany in the Kremlin. French sources said Macron found him a changed man compared with their previous meeting three years earlier, lecturing him over five hours on grievances dating back to the end of the Cold War.
At a news conference afterwards, Putin said he was willing to keep negotiating. But in one of a series of angry public diatribes, he also evoked the threat of a Russia-NATO conflict if Ukraine joined the alliance, demanding of a French reporter: "Do you want France to go to war with Russia?"
In the last 10 days before the invasion, Putin sent out false signals. At a made-for-TV moment on Feb. 14, his foreign minister, Sergei Lavrov, was shown telling him that diplomatic possibilities were "far from exhausted" and recommending continuing down that track.
In the following days, the Russian defence ministry published video that it said showed Russian tanks, infantry fighting vehicles and self-propelled artillery units pulling away from areas surrounding Ukraine. Financial markets briefly rallied, until NATO and the United States said Moscow was in fact adding even more units and edging closer to the border.
The final step for Putin was to put in place a quasi-legal basis for intervention - much as he had with the 2014 seizure of Crimea, which he justified with the staging of a referendum.
On Monday he recognised the "independence" of two Russian-backed separatist regions in eastern Ukraine which have been fighting Ukrainian government forces for eight years, and signed friendship treaties allowing for the deployment of Russian forces there and the establishment of Russian military bases.
The signing was preceded by a speech lasting nearly an hour in which Putin argued that Ukraine was an artificial country that "never had a tradition of genuine statehood". Now, he said, it was a U.S. puppet and a springboard for NATO aggression against Russia.
"From those who seized and hold power in Kyiv, we demand an immediate cessation of hostilities," Putin said. "Otherwise, all responsibility for the possible continuation of the bloodshed will be entirely on the conscience of the regime ruling on the territory of Ukraine."
Just over 48 hours later, Russian forces invaded Ukraine by land, air and sea.