Saudi Arabia has witnessed a series of bloody attacks against its citizens and expatriate workers in the last 18 months, which has severely shaken international confidence in the oil-rich Gulf kingdom.
The first wake-up call came on 12 May 2003 - a co-ordinated suicide bombing blamed on al-Qaeda of three housing compounds for foreigners in the capital Riyadh that left 35 people, including at least nine bombers, dead.
Gunmen managed to slip past police at Khobar's Oasis compound
At the time it was described as the kingdom's own 9/11 - and it galvanised the Saudi authorities into taking their first serious steps to join the US government's "global war on terrorism".
Six months later, 17 people were killed when another compound, this time one for Arab families, was bombed - right on the doorstep of one of the royal palaces in Riyadh.
Since then the Saudis have rounded up more than 600 Islamic militant suspects and seized large quantities of arms, and they have killed or captured most of the men on a wanted list containing 29 names.
But attacks by suspected al-Qaeda supporters have continued, and - for a while - seemed to by gaining sophistication.
However, Saudi government aides say the latest bout of high-profile terrorism, an attack on the US consulate in Jeddah, has shown that while the threat may not be over it may be being brought under control.
Crescendo of killing
The most sustained period of attacks started on 21 April 2004, when a Riyadh police headquarters was struck by a suicide attacker, killing four people.
Then came a gun rampage at a petrochemical company on 1 May in the Red Sea port of Yanbu which left six Westerners and a Saudi dead.
Three of the gunmen apparently worked at the company and used their entry passes to gain access to their victims - one of whom was paraded through the streets in a grisly ritual.
Following that, a German citizen was gunned down by unidentified attackers on a Riyadh street.
Then came one of the most high profile attacks, in Khobar in which 22 civilians were killed. The attackers escaped, slipping through a police cordon which some outside security experts said showed signs of collusion between besiegers and besieged.
Since then nothing has come close to the Khobar bloodshed, although there has been a steady succession of shootings and ambushes - including one that killed a BBC cameraman and left his colleague seriously injured.
There are two schools of thought regarding Saudi Arabia's security problem.
Saudi officials insist this is the last gasp of a movement that the state has done everything to shut down, through strong policing, good intelligence, and curbing the very ideology that produces these attacks.
In May officials said six terror cells had been identified in the previous 12 months, consisting of about 25-to-30 members each. They said five of the six have now been smashed by the security forces.
The string of attacks has perplexed Saudi Arabia
But the credibility of Saudi officials' claims has been undermined by the continuation of small-scale shootings linked to Islamic militants - an Irish citizen gunned down in his office in August, a Briton and a Frenchman in separate incidents in September.
Saudi ambassador to the UK Prince Turki al-Faisal - himself a former Saudi intelligence chief - told the BBC that it would be very difficult to scotch the movement entirely.
"These people are willing to kill themselves to achieve their purposes, it's practically impossible to prevent them totally from taking their action," he said in a BBC interview in May.
But it seems true that the killers have not been able to repeat their earlier spectacular successes - perhaps because across the kingdom likely targets are now heavily guarded and on high alert around the clock.
Anger and hatred
The other school of thought holds that Saudi Arabia is incapable of quelling the massive groundswell of anger and hatred towards the West engendered by the US-led invasion of Iraq and the Israel-Palestinian conflict that triggers such attacks.
Author and former CIA operative Robert Baer said the killings in May - in the Saudi oil producing heartland - were meant to send a direct message to the Opec meeting of oil exporting countries.
Accusations of complicity have dogged the security services
He said the militants were giving expression to many ordinary Saudis' discontent about government plans to increase production to bring world oil prices down, in particular to help the US economy.
"Saudi Arabia's oil facilities are vulnerable and a determined effort could take one of these facilities out," Mr Baer said.
However the fact is that terrorist successes have been few and far between in the last six months. Where they do occur they have mainly been against softer targets.
When something high-profile like a US consulate is targeted, the death toll seems much lower and the security forces seem much more able to cope than in earlier attacks.
But are the authorities really just mopping up the last remnants of the militants? It may be premature to say that.