Despite massive protests across the Islamic world, and in many European capitals, the US-led military operation had initially appeared to be successful. The US, supported by British and Israeli special forces, had bombed 37 sites, including underground facilities in which Iran was said to be on the verge of making a nuclear weapon using its own version of P-2 centrifuges. The model for these had been originally supplied by AQ Khan, the rogue Pakistani nuclear scientist. US forces had taken down Iran's air defences and destroyed much of its air force. Inevitably, there were civilian casualties - estimated by the Iranian government at 197 dead and 533 injured. A Pentagon spokesman insisted that "collateral damage" had been confined to "an acceptable level". He claimed Iran's nuclear weapons programme had been "knocked back to first base".

The US navy had also successfully broken an attempted Iranian naval blockade of the Strait of Hormuz, one of the main arteries of the world's oil supplies. A US gunship had been damaged by an Iranian underwater missile attack, but with no loss of American lives. In panic on the oil markets, the price of crude oil had soared to more than $100 a barrel, but the Bush administration had built up America's strategic oil reserves and the new Clinton administration was able to draw on these. European economies were worse hit.

As experts had predicted, however, the biggest challenge for the west was Iran's ability to wage asymmetric warfare through Hizbullah, Hamas and its own suicide-bombing brigades. The Islamic Republic had for years been openly recruiting suicide bombers through an organisation described as the Committee to Commemorate Martyrs of the Global Islamic Movement. As early as April 2006, it had held a recruitment fair in the grounds of the former US embassy in Tehran, claiming it already had more than 50,000 volunteers for operations against "the al-Quds occupiers" (that is, Israel), "the occupiers of Islamic lands", especially the US and Britain, and the British writer Salman Rushdie. Recruits could also sign up through the internet (www.esteshhad.com) While Hizbullah and Hamas provided the infrastructure for the Tel Aviv bombings, the key to the attacks on London and New York was the recruitment of British and American Muslims through this group. The man who detonated the dirty bomb at Euston station, Bradford-born Muhammad Hussein, had been secretly trained by the Committee to Commemorate Martyrs at a camp in northern Iran.

With hindsight, it appears that the turning point may have come in the spring of 2006. Iran's president, Mahmoud Ahmadinejad, having proclaimed his intention to wipe Israel off the face of the earth, announced that his country had already successfully enriched uranium and hinted that it had the superior P-2 centrifuge technology. Whether true or not, these claims effectively destroyed the last hopes of achieving a diplomatic solution through negotiations led by the so-called E3 - France, Germany and Britain.

A long, tortuous diplomatic dance followed, with China and Russia eventually agreeing to minimal UN sanctions on Iran, including visa bans on selected members of the regime. These had little perceptible impact on the Iranian nuclear programme, but were successfully exploited by the regime to stoke up an always strong national sense of victimisation. Meanwhile, the exposure of the clumsy channelling of US government financial support through a California-based monarchist exile organisation to a student group in Isfahan was used as a pretext for a brutal clampdown on all potentially dissident groups. Several show trials for "treason" were staged despite international protests. This produced a further hardening of US policy in the last years of the Bush administration. In the 2008 US presidential campaign, the Democratic candidate, Hillary Clinton, felt compelled - perhaps against her own better judgment - to use the Iran issue to demonstrate that she could be tougher than John McCain on national security issues.

When she came into office, she was already committed to preventing Iran obtaining a nuclear weapon, by military means if necessary. Meanwhile, the Iranian regime had abandoned all restraint in its pursuit of that objective, calculating that its own best chances of survival lay in the swiftest possible acquisition of a nuclear deterrent. In February 2009, an alarming intelligence report reached Washington, suggesting that Tehran - using a secret cascade of its version of the P-2 centrifuge - was much closer to obtaining a bomb than had been thought. In a series of crisis meetings, President Clinton, her new secretary of state, Richard Holbrooke, and her new secretary of defence, Joe Biden, decided that they could afford to wait no longer. Operation Gulf Peace, for which the Pentagon had long made detailed contingency plans, started on March 6 2009.

Washington claimed that it had legal authorisation under earlier UN security council resolutions sanctioning Iran for its non-compliance on the nuclear issue, but these claims were disputed by China and Russia. Most European countries did not back the operation either, producing another big transatlantic rift. However, under enormous pressure from his close friends among US Democrats, the British prime minister, Gordon Brown, reluctantly decided to give it his approval, and allowed the token deployment of a small number of British special forces in a supporting role. This provoked a revolt from the Labour backbenches - led by the former foreign secretary, Jack Straw - and a demonstration of more than 1 million people in London. Even the Conservative leader, David Cameron, mindful that a general election was expected soon, criticised Brown's support for the American action. Brown therefore postponed the British election, which had been provisionally scheduled for May 2009. Instead of an election, the country experienced a tragedy.

Meanwhile, President Ahmadinejad faced a presidential election in June 2009. Unlike Brown, he was riding high on a wave of national solidarity. Even the many millions of Iranians disappointed by his failure to deliver on his material promises, and those who despaired of their country's international isolation, felt impelled to rally round the leader in time of war.

Many prominent Americans criticised the US military action. Some claimed to know that the presidential spouse, Bill Clinton, was privately among those critics, although in public he was loyalty itself. But Dr Patrick Smith of the Washington-based Committee for a Better World, which had long advocated bombing Iran, demanded of the critics: "What was your alternative?"

www.timothygartonash.com