WASHINGTON • The operation that took out Major-General Qassem Soleimani, commander of the Quds Force of Iran's Islamic Revolutionary Guard Corps, propelled the United States to the precipice of war with Iran and plunged the world into seven days of roiling uncertainty.
The story of those seven days, and the secret planning in the months preceding them, ranks as the most perilous chapter so far in US President Donald Trump's three years in office.
The President's decision to ratchet up decades of simmering conflict with Iran set off an extraordinary worldwide drama, much of which played out behind the scenes. In capitals from Europe to the Middle East, leaders and diplomats sought to head off a full-fledged new war, while at the White House and Pentagon, the President and his advisers ordered more troops to the region.
European leaders, incensed at being kept in the dark, scrambled to keep Iran from escalating the situation. If it did, Americans had developed plans to strike a command-and-control ship and conduct a cyber attack to partly disable Iran's oil and gas sector. But the US also sent secret messages through Swiss intermediaries, urging Iran not to respond so forcefully that Mr Trump would feel compelled to go even further.
After Iran did respond - firing missiles at bases housing US troops without hurting anyone, as a relatively harmless show of force - a message came back through the Swiss saying that would be the end of its reprisal for now.
Accidental confrontation The confrontation may have actually begun by accident. For years, Iran has sponsored proxy forces in Iraq, competing for influence with US troops who first arrived in the invasion of 2003. Starting last autumn, Iranian-backed militias launched rockets at Iraqi bases that house US troops, shattering nerves more than doing much damage.
So when rockets smashed into the K1 military base near Kirkuk on Dec 27, killing an American civilian contractor, Mr Nawres Waleed Hamid, and injuring several others, the only surprise was the casualties.
US intelligence officials monitoring communications between Kataib Hizbollah and Maj-Gen Soleimani's Guard learnt that the Iranians wanted to keep the pressure on the Americans but had not intended to escalate the low-level conflict.
The rockets landed in a place and at a time when US and Iraqi personnel normally were not there, and it was only by unlucky chance that Mr Hamid was killed, US officials said.
But that did not matter to Mr Trump and his team. The President agreed to strikes on five sites in Iraq and Syria two days later, killing at least 25 members of Hizbollah and injuring at least 50 more.
Two days later, on Dec 31, pro-Iranian protesters backed by many members of the same militia responded by breaking into the US Embassy compound in Baghdad and setting fires. Worried about repeats of the 1979 embassy takeover in Iran or the 2012 attack on a diplomatic post in Benghazi, Libya, Mr Trump and his team ordered more than 100 Marines to rush to Baghdad from Kuwait.
Still, Mr Trump remained agitated and ready to authorise a more robust response. And on Dec 31, even as protests were beginning, a top secret memo began circulating, signed by Mr Robert O'Brien, his national security adviser, listing potential targets, including an Iranian energy facility and a command-and-control ship used by the Guard to direct small boats that harass oil tankers in the waters around Iran.
The ship had been an irritant for months, especially after a series of covert attacks on oil tankers.
The memo also listed a more provocative option: targeting specific Iranian officials for death by military strike. Among the targets mentioned, according to officials who saw it, was Maj-Gen Solei-mani.
As head of the elite Quds Force, the general was effectively the second-most powerful man in Iran and had a hand in managing proxy wars in Iraq, Syria, Lebanon and Yemen, including a campaign of roadside bombs and other attacks that killed an estimated 600 US troops during the height of the Iraq War.
For the past 18 months, officials said, there had been discussions about whether to target Maj-Gen Soleimani. By the time tensions with Iran spiked last May with attacks on four oil tankers, Mr John Bolton, then the President's national security adviser, had asked the military and intelligence agencies to produce new options to deter Iranian aggression.
Among those presented to Mr Bolton was killing the general and other leaders of the Guard. At that point, work to track the general's travels grew more intense.
By September, the US Central Command and Joint Special Operations Command had been brought into the process to plan a possible operation. Agents recruited in Syria and Iraq began reporting on the general's movements, according to an official involved.
Soleimani's last trip
Maj-Gen Soleimani set off on his last trip on New Year's Day, flying to Damascus and then heading by car to Lebanon to meet Hizbollah leader Hassan Nasrallah, before returning to Damascus that evening.
That same day, at Central Intelligence Agency (CIA) headquarters in Langley, Virginia, Ms Gina Haspel, the director, was shown intelligence indicating that the general was preparing to move from Syria to Iraq. Officials told her there was additional intelligence that he was working on a large-scale attack intended to drive US forces out of the Middle East.
There was no single definitive piece of intelligence. Instead, officials said, CIA officers spoke of the "mosaic effect", multiple scraps of information that came together indicating that Maj-Gen Soleimani was organising proxy forces around the region, including in Lebanon, Yemen and Iraq, to attack US embassies and bases.
There was little dissent about killing the general among Mr Trump's senior advisers, but some Pentagon officials were shocked that the President picked what they considered the most extreme option, and some intelligence officials worried that the possible long-term ramifications were not adequately considered, particularly if action on Iraqi soil prompted Iraq to expel US forces.
Maj-Gen Soleimani died in a drone strike at Baghdad's airport on Jan 3. Altogether, 10 people were killed: the general, Mr Abu Mahdi al-Muhandis - an Iraqi official in charge of militias and close to Iran - and their aides.
Mr Trump issued bellicose threats to destroy Iran, including its cultural treasures, if it retaliated, touching off international outrage and forcing his own defence secretary to publicly disavow the threat, saying it would be a war crime. Mr Trump was largely alone on the world stage. No major European power voiced support for the drone strike, even as leaders agreed the general had blood on his hands.
Mr Trump's withdrawal from the 2015 nuclear accord with Iran has been a major point of contention. European leaders deeply resented the unilateral pullout, seeing that as a grave error that started a cycle of sanctions and recriminations that led to the seven-day showdown and now the restart of the Iranian nuclear programme.
'Revenge in proportion'
The most important European country in these seven days, it turned out, was Switzerland, which has served as the intermediary between the US and Iran since they broke off diplomatic relations in 1980. Hours after the strike, Mr Markus Leitner, the Swiss Ambassador in Teheran, headed to the Iranian Foreign Ministry, according to a Swiss analyst.
The Americans had sent a letter to the Iranians through the Swiss, warning against any retaliation for the drone strike that would incite further military action by Mr Trump. The Americans "said that if you want to get revenge, get revenge in proportion to what we did", Rear-Admiral Ali Fadavi, deputy commander of the Guard, told Iranian state television.
Unbeknown to the Iranians, Mr Trump had agreed to targeting the other sites originally considered - the oil and gas facility and the command-and-control ship - as part of any further retaliation that might be necessary if Iran responded to the drone strike.
Last Tuesday, the Defence Special Missile and Astronautics Centre, part of the National Security Agency, pulled together multiple strands of information, including overhead imagery and communication intercepts, to conclude that an Iranian missile strike on Iraqi bases was coming, officials said.
The missiles damaged a helicopter, some tents and other structures but, thanks to the advance warning, inflicted no casualties.
And through the Swiss came another message: That was it. That was Iran's retribution.
The Americans were struck by the speed of the communication; it was shown to Mr Trump and Secretary of State Mike Pompeo within five minutes of the Swiss receiving it from Iran.
The next morning, Mr Trump addressed the nation from the White House and, while he excoriated Iran's "campaign of terror", he made clear he would not retaliate further. "Iran appears to be standing down," he said, adding that he was "ready to embrace peace with all who seek it".
After seven days of sabre-rattling and fresh deployments, the immediate march to war had ended.
But few consider the crisis to be over. In the months to come, they expect Iran to regroup and find ways to strike back.
"Soleimani as a person inspired the masses. He was a national icon. He symbolised the struggle," said Mr Ali Alfoneh, a senior fellow at the Arab Gulf States Institute in Washington who studies Iran. "But he was also a very small part of a very large organisation."
"Yes, it is decapitated, but the organisation is not destroyed," he added.