Predictions at the start of the invasion of a quick Russian victory have been upended by the Ukrainians' willingness to fight, but the war is settling into a long struggle that could still endanger the wider world too.
Remember how it was in Kyiv after the Russians invaded: thousands cramming bitterly cold railway platforms, pushing and shoving to get any train heading away from the Russians. At the height of it, in the week that straddled the end of February and the beginning of March, 50,000 people were moving west from Kyiv station every single day. Rusty carriages that looked as if they had spent years pensioned off in some siding were hauled back into service so the railway company could lay on dozens of extra services.
Most of the passengers were women and children. Men stayed. The law stated they could not leave the country as Ukraine needed them to fight. I did not see any press gangs. Mostly, it was a nation of willing volunteers. Kyiv's population of around four million halved. Some of the women who didn't leave put on uniforms to fight. Outside a volunteer centre I met a woman called Katrine hugging Nikita, her 18-month-old son. It was a brief reunion as her unit rotated through Kyiv. Katrine was a sniper, who said she was ready to kill to give her son a future.
As I drove into Kyiv from the south a few days into the invasion, a Russian convoy 40 miles long was heading towards the city from the north and north-west, from Belarus, Russia's ally. Belarus is the sort of neighbour Russia's President Vladimir Putin wants. Its leader, Alexander Lukashenko, is happy to have Putin's patronage and to accept a role as Russia's client state. Even so Lukashenko did not send his troops into Ukraine, which many outsiders had assumed was part of the Kremlin's battle plan. Perhaps even Putin accepted that loyalty has its limits.
Everyone in Kyiv feared the worst. The city centre was mostly empty, except for armed and anxious men at checkpoints who were ready to believe that anyone behaving in a way they didn't like was a Russian saboteur. The rumble of explosions rolled in from the edge of the city. Everyone feared the all-powerful Russians were about to encircle Kyiv and attack.
On my first night I decided not to sleep in the hotel shelter, at the second basement level. It was overcrowded and airless, and the city centre had not been hit. It felt like a gamble. But as I write this, six weeks later, in the same hotel room on the fourth floor, Kyiv's beautiful and historic centre has still not been attacked, even though it is well within range of Russia's missiles and air force.
In six weeks, so much has changed. The long convoy got bogged down and destroyed. The Russians retreated. The war is far from over, but the Ukrainians won the battle of Kyiv. The first battle. There could be another.
Ukrainian willingness to fight and die upended every prediction of a swift Russian victory. At a military funeral of a soldier killed stopping the Russian advance, his mother and sister sobbed, clutching his portrait. Volleys were fired over his coffin, and hundreds of his comrades lined up to sing their national anthem and roar patriotic slogans.
They looked like who they were, volunteers with ages that ran from late teens to late middle age, wearing a range of uniforms and carrying a variety of weapons. Ukraine also has much more professional-looking, highly trained soldiers.
Together with clever leadership, sharp tactics and Nato weapons they have fought so well that the world's perception of their country has changed. At a photo opportunity at the Nato meeting in Brussels this week foreign ministers of some of the world's most powerful democracies were jostling to get close to the guest of honour, their Ukrainian counterpart Dmytro Kuleba. Differences are emerging in the North Atlantic Alliance and the European Union about how to increase the pressure on Russia, but they all wanted a little Ukrainian stardust.
In war, leadership has always been critical, and in modern war the messages on the media battlefield are more significant than ever. Ukraine's President Volodymyr Zelensky is winning that part of the war. Instead of heading for safer ground he stayed, swapping suits for khaki t-shirts.
It is ironic that one of Putin's arguments for Ukraine to be in Russia's orbit is that it is not a proper country. His own actions, along with Zelensky's well-judged messages as he leads a remarkable feat of mobilisation, are sharpening the national identity of Ukrainians.
Another factor for Ukrainian success is that humans caught up in wars adapt fast, once the shock wears off. In a trendy part of Kyiv hipster craft makers repurposed their workshop to turn out steel barriers with vicious spikes to rip tyres. In the basement of a volunteer depot young women tore up sheets to make fuses for Molotov cocktails. The air in the unventilated space was heavy with petrol vapour. Checkpoints in Kyiv went from jumpy armed men with barriers made of a few tyres - to well-fortified sandbagged strongpoints.
Ukrainian defiance has also been a key factor. Thousands of volunteers signed up to learn how to handle weapons and fight. Among them were two young men we've followed ever since, university students Dmytro Kisilenko, aged 18, and his friend Maksym Lutsyk, who's 19. When they signed up to fight at the beginning of March the volunteers of their age looked like young guys off to a festival. Now they have seen action on the front line, and like every other Ukrainian have had their view of the world and the lives they will lead in it shaken.
The two young soldiers, Maksym and Dmytro, have been in Kyiv this week buying the new gear they'll need when they're rotated into the battles of the east in a few days. For Maksym, like all Ukrainians, this is the fight of their lives.
"We are not fighting here only for our country's life, we are fighting for the life of the whole civilised world because the biggest goal for us is to defend our freedoms and rights in Europe, in and out of our country. Every one of us understands that there will not be freedom in the whole world while Russia occupies our territories."
Weeks as a frontline soldier have changed Dmytro. "Human life matters, your relatives or friends. Your country matters, first of all… I become more systematic and unfortunately more ruthless because of the latest news and what I have already been through. Ruthless to Russian soldiers, ruthless to all the situations. I've become more like a soldier."
Russia suffered a serious defeat around Kyiv and had to pull back. But it has not lost the war, and is grinding out territorial gains in the east and south. Since they left the Kyiv Oblast the damage they have done is clearer than ever.
The damage to property is extensive. I have seen terrible devastation in the centres of towns like Irpin and Borodyanka. Far more serious, and alarming, is what has been done to civilians and other non-combatants. I have seen dead bodies, some definitely civilians, left where they were killed by the Russians. The evidence that war crimes were perpetrated by Russian troops is becoming overwhelming. Accusations have also been levelled at Ukrainian forces, after a video emerged that appeared to show their soldiers killing wounded Russians who were lying helpless on the ground.
This war is a world crisis not just because the Russians have driven a tank through international law, or for what they have done to civilians, but because it has brought the biggest military powers with nuclear weapons closer to a potential confrontation than at any time since the Cold War that ended with the fall of the Soviet Union, culminating in 1991.
The 21st Century now has its own Cold War, with the same risks attached if it gets hot. The head of defence intelligence in Ukraine, Maj Gen Kyrylo Budanov, told me that the risks of not confronting Putin's Russia are much worse for Nato than risking escalation by standing up to him and sending Ukraine the much more lethal arsenal it wants.
"This is a war of aggression in the heart of Europe that completely destroys existing political and military security systems. If the world swallows Putin's aggression and offers no radical solution, it will be repeated over and over again," he said.
Kyiv is much calmer now than in the icy first days of the invasion. It's very different in the east, where soldiers are gathering, and thousands of civilians are leaving everything they've ever known. The invasion of Ukraine took many by surprise. But the crisis between Russia and the West was brewing for years. Many, not just politicians, refused to recognise the signs.
A collective amnesia settled over the wars of former Yugoslavia of the 1990s. Europe, it was assumed, was too wise, rich and self-interested to still be that old continent where blood could be spilled to change borders and topple governments. Now we know that view was complacent and wrong. Western leaders are having to think very hard and very quickly about how to readjust to this new era's challenges and dangers.
This is going to be a long, attritional struggle. The stakes are high. If it escalates into a fight to the finish between Putin's presidency and Ukraine's independence the wider world will face even worse danger.