Amman, Jordan (CNN) Iraq and Syria have been riven by violence for years but their neighbor, Jordan, has been largely immune to the bloodshed that has swept across the region. Until now.

The so-called "Kingdom of Peace" and "Oasis of Stability," was rocked Sunday by a deadly terrorist attack many had long feared was coming.

Jordan's position as a key US ally in the region has placed it at the forefront of the war against extremism, making it a top target for groups like ISIS and al Qaeda.

Over the past year Jordan has seen multiple terrorist incidents, but until Sunday's attack on Karak Castle, a popular tourist attraction , they have been mostly directed at the country's security forces.

Countless plots thwarted

In March, Jordan said it had foiled a plot by an ISIS-linked cell planning to attack civilian and military sites. Heavily armed militants wearing suicide belts holed up in a building in the second city Irbid, engaging with elite forces for hours in a kind of urban warfare most Jordanians had never seen before.

We arrived just as special operations teams combed the area for explosives and booby traps. The cordoned off scene was reminiscent of scenes I had previously covered in Iraq -- the façade of the building blackened, bullet casings and glass strewn all over the street, and balaclava-clad security personnel clearly on edge after losing two colleagues.

There was little doubt that, had the attack been successful, the result would likely have been catastrophic.

JUST WATCHED Jordan foils 'criminal plot linked to ISIS' Replay More Videos ... MUST WATCH Jordan foils 'criminal plot linked to ISIS' 01:46

Then in June many here were stunned to wake up to the news a gunman had walked into an office of the country's intelligence agency and killed five employees.

An attack like this was unimaginable in a country known for having one of the strongest intelligence services in the Middle East; a very capable force that officials say has thwarted countless plots targeting Jordan over the years.

No group claimed responsibility, but some officials said the attacker was a self-radicalized lone wolf.

Zero tolerance terrorism policy

What alarms many Jordanians is the threat from within its own borders, and the idea that that highly-skilled and radicalized fighters with access to weapons and explosives could be hiding among the general population.

JUST WATCHED Car bomb kills Jordanian security guards Replay More Videos ... MUST WATCH Car bomb kills Jordanian security guards 02:19

While officials downplay the level of support groups like ISIS have in the kingdom, an estimated 2,000 Jordanians are believed to have gone to Syria to fight alongside the terror group or with the al Qaeda affiliate formerly known as Jabhat al-Nusra.

The government says it has a zero tolerance policy when it comes to terrorism or even perceived sympathy for terrorist groups -- even voicing support for such groups is an offense punishable with jail time.

Jordan's history of Jihadist links is a long one: From Chechnya to Afghanistan to Iraq. And the roots of ISIS can be traced back to the al Qaeda group headed by Jordanian-born Abu Musab al-Zarqawi -- killed in a US strike in Iraq in 2006.

Country stretched to limit

But it is not only the country's alliance with Western powers like the United States that has driven many of its young men into the arms of these groups.

Jordan is a country of few resources, with high unemployment and a struggling economy, and many feel economic dissatisfaction and a lack of jobs has led people to join the militants.

JUST WATCHED Jordan's King Abdullah: ISIS is enemy number one Replay More Videos ... MUST WATCH Jordan's King Abdullah: ISIS is enemy number one 03:20

The government and the monarchy have attempted to boost the economy, but with Jordan hosting more than one million refugees, the tiny Kingdom has been stretched to its limit.

In a recent interview with CBS's 60 Minutes, King Abdullah II said taking in such a large number of refugees had placed a huge burden on his country. Asked what the breaking point for his people is, the monarch said "About a year or two years ago."

"Unemployment is skyrocketing. Our health sector is saturated. Our schools are really going through difficult times," he said. "It's extremely, extremely difficult. And Jordanians are just have had it up to here. I mean we just can't take it anymore."

"If anything keeps me up at night," the King told CBS, "it is giving the younger generation an opportunity at life ... If radicalization is going to embed itself anywhere ... it's going to be disenfranchised youth. And so if young people in this country are not going to have an opportunity because of the pressure on the economy again, that's my concern."

Tourism industry hit

One of the main revenue streams for Jordan was its tourism sector: Historic and archaeological sites -- including Petra, the ancient city listed among the seven wonders of the modern world -- are spread across a country known for its hospitality.

JUST WATCHED Jordan's economy hurt by drop in tourism Replay More Videos ... MUST WATCH Jordan's economy hurt by drop in tourism 03:08

But tourists have avoided the region in recent years. Government-funded international advertising campaigns have been launched in an attempt to lure them back, and Sunday's attack will only make that task harder -- it is the first time civilians and tourists have been among the casualties since a series of suicide bombings at Amman hotels in 2005.

Until now, Jordan has clearly defied the odds in a turbulent region, but many feared that terrorist attacks against the kingdom were inevitable.

A senior government official last year told that the threat of terrorism facing Jordan and countries across the world is part of a new global reality.

With ISIS on the back foot and the expectation that the group will now revert to headline-grabbing attacks rather than trying to secure territorial gains, the threat to Jordan is likely higher now than it has ever been.