Ukraine: Inside the spies’ attempts to stop the war
Traditionally, it is the job of a spy to keep secrets - but as the invasion of Ukraine loomed, Western intelligence officials made the unusual decision to tell the world what they knew.
For nearly a dozen days in February, a small group of intelligence officers had been going to bed early.
They had seen the intelligence predicting a war and knew that if Russia was really going to invade Ukraine, it would begin in the early hours of the morning.
But when the news finally came on 24 February, it still felt unreal, one recalls: "It was hard to believe it was actually happening until I woke up early that morning and put the radio on."
For months they had been sounding the alarm.
"That day people went from 'Why are you being so hysterical?' to 'Why weren't you more hysterical?'" says the official.
There was no satisfaction in being proved right, another intelligence official adds. But at least they felt they had tried to stop a war whose scale they had been warning of for months.
The run-up to war and the weeks after it started saw American and British intelligence make public some of their most closely held secrets as part of an unprecedented campaign.
For decades, intelligence had normally been something to share with as few individuals as possible. No longer. The decision had been taken to make the whole world know about it.
This not only marked a dramatic shift in the way Western intelligence had been operating - it also meant confronting the painful legacy of the invasion of Iraq.
The first signs of Russia's intentions arrived a year ago. Intelligence from satellite imagery pointed to a Russian troop build-up near Ukraine. But analysts had little understanding of Moscow's true intentions.
That changed in mid-2021. "From summer we saw a small group of senior people planning for a full military invasion of the whole country," explains one Western intelligence official.
The intelligence-gathering and analysis was a joint US-UK affair, those involved say - one calling it a "family" operation. There was no single moment of understanding but rather a picture that became increasingly clear as time passed.
The exact provenance of the intelligence remains classified - officials suggest it came from multiple sources. But it provided a picture which continued to build as London and Washington saw invasion plans being finalised.
Vladimir Putin seemed to believe he had to act quickly to fulfil his ambition of bringing Ukraine back into Russia's sphere of influence. And he believed the only way to do so was by using force. "He felt like he had a closing window of opportunity," says one person who was directly involved.
By autumn, Washington had decided it needed to do something with what it was being told by its spies. That decision, those involved say, was taken at the very highest level of the White House by President Biden.
A crucial moment came in early November when CIA Director William Burns travelled to Moscow - to warn that Washington knew what was being planned. The trip was not kept secret. The first time some Russian officials were told that their country might be seriously intending to act against Ukraine was when they heard it from the director of the CIA, one official says.
The next stage was to make some of the intelligence public. One individual involved in the discussions, who like others spoke on condition of anonymity, recalls times where it was asked: "What is the point of knowing all of this, if we can't do something with it?"
In Washington, Director of National Intelligence Avril Haines - who briefed allies at Nato in November - and National Security Adviser Jake Sullivan are credited with pushing for the release of material. Experts on declassification, trained to understand the risks, began to work round the clock to establish what could be shared.
"The Intelligence Community surged personnel and resources to support classification reviews for increased intelligence sharing with allies and partners and declassification reviews for potential release to the public (and) leveraged its established declassification process, which is designed to protect sources and methods," Nicole de Haay, a spokeswoman for the US intelligence community, told the BBC.
One advantage was being able to use commercially available satellite imagery to support the case. By early December, details of Russia's plans for a 175,000-strong invasion had appeared in the Washington Post.
In London, the intelligence - coming in from GCHQ and MI6 - was met with near-disbelief in some quarters. A common problem inside and outside government was that people simply could not believe a major land war could break out in Europe in the 21st Century.
It was only late in the year - after the material went through a formal assessment process and the Joint Intelligence Committee issued its considered view that an invasion was now "highly likely" - that everyone began to realise this was for real.
The rigour of that process was a direct result of lessons learned nearly two decades ago when intelligence had been used to make the public case for war in Iraq in a haphazard, improvised way. In 2003, amid accusations of politicisation, the reputation of US and UK spies was damaged - especially after the intelligence proved to be wrong.
The ghosts of Iraq have since haunted discussions about using intelligence in public - but Ukraine offered an opportunity to try to put that legacy to bed. New procedures had been put in place to ensure secret information went through a strict assessment process to govern how it could be used.
Other allies were also briefed. But many remained sceptical. Because the source of the intelligence could not be shared it was sometimes hard to overcome this incredulity, one official says.
Some European partners did not buy the analysis that Russia's build-up was anything more than bluff. A scepticism about Anglo-American intelligence was also another legacy of Iraq's missing weapons of mass destruction. France has recently sacked its head of military intelligence for failing to appreciate what was being planned.
The fear for spies in publicising material is that this tips off the other side that they have a leak and potentially closes off that source. This was why, in World War Two, the UK kept the secret of Bletchley Park so tightly. There have been other occasions since Iraq when intelligence has been made public, for instance over the use of chemical weapons in Syria, but never on the scale seen over Ukraine.
The release included the UK sharing details of Russian plans to install specific individuals as part of a puppet government in Kyiv - and Washington revealing plans by Moscow to stage pretexts for war, so-called false flags, involving dead bodies whom they would falsely claim had been killed by Ukrainians.
American and British spies both believe that publicising this material robbed Moscow of the ability to justify the invasion to its own people and other countries as a defensive move.
One spy says of those days before the invasion that he had never seen anything like it - highly classified material would be on his desk one day and then emerge in the public domain the next.
But the unprecedented outpouring of intelligence was not enough to stop the invasion.
The public release had not deterred Moscow. That may never have been possible but officials believe it did disrupt Russia's plans. And it meant the reaction across the West was swifter and more unified than it might otherwise have been, they argue.
They say they made it much easier for other countries to rally round tougher measures than if there had been a confused and disputed picture of who was the real aggressor.
The release has continued after the invasion in speeches, statements and briefings - the head of GCHQ claimed just over a week ago that Putin was still not getting the full picture from his own officials and there have been warnings of possible "false flag" use of chemical weapons.
There is also a recognition of a new world in which so-called open-source intelligence - things like commercial satellite imagery and data - has made it more possible to verify or support assertions and that fighting an information war - including through intelligence - is now vital, partly to counter Russian assertions.
On one level, much of the intelligence was spot-on. There was, as forecast, a full invasion from multiple directions with the purpose of toppling and replacing the Zelensky government.
Western spies also correctly predicted that Moscow had misplaced confidence about the reception it would encounter. "They genuinely believed there would be flags out to welcome them," says a Western intelligence officer.
But one assumption did prove wrong - that Moscow's military would prevail in a matter of weeks. Instead, the war would not turn out as many expected, with Ukraine outperforming militarily while Russia underperformed.
That is a reminder that intelligence has its limits - particularly in predicting some of the complexities of war and the uncertainties of people's morale and reaction. And for all its success before the war, Western spies concede that intelligence cannot tell them for sure what will happen next.