AMMAN, Jordan -- Gunmen ambushed Jordanian police in a series of attacks Sunday, including at a Crusader castle popular with tourists, killing seven officers, two local civilians and a woman visiting from Canada, officials said.

At least 27 people were wounded in one of the bloodiest attacks in Jordan in recent memory.

The standoff between Jordanian special forces and armed men holed up inside the castle continued after nightfall Sunday, several hours after the first shooting. Government officials declined comment on local news reports that the attackers had taken hostages who were later freed.

Get Breaking News Delivered to Your Inbox

Shots could still be heard at the scene on Sunday evening, and security forces fired tear gas to flush out the gunmen.

Compared to many of its neighbors, Jordan has enjoyed relative peace since the Arab Spring, the Syrian civil war, and the rise of the Islamic State of Iraq and Syria. However, Sunday’s shootings were the latest in a series of attacks that have challenged the pro-Western kingdom’s claim to be an oasis of calm in a region threatened by Islamic extremists.

There was no immediate claim of responsibility for the attacks in and near the town of Karak.

The chain of events began when a police patrol received reports of a house fire in the town of Qatraneh in the Karak district, said a statement by Jordan’s Public Security Directorate.

The officers responding to the call came under fire from inside the house, the statement said. Two policemen were wounded and the assailants fled in a car, it said.

In another attack, gunmen fired on a security patrol in Karak, causing no injuries, the statement said.

Armed men also opened fire on a police station in Karak Castle, a Crusader-era fort, wounding members of the security forces. The statement said five or six gunmen were believed to be holed up inside the castle.

The Jordan tourism board describes Karak as “a fortress since biblical times. The Bible relates how the King of Israel and his allies from Judah and Edom ravaged Moab and besieged its king Mesha in the fortress of Kir Heres, as Karak was then known.”

In all, four members of the security forces and a female tourist from Canada were killed in the shootings, though it was not clear if all five were killed at the castle.

Jordan faces homegrown extremism, with hundreds of Jordanians fighting alongside other ISIS militants and several thousand more supporting the extremist group in the kingdom. Jordan is a key U.S. ally, and a member of a U.S.-led military coalition fighting ISIS.

Over the past year, gunmen have carried out several attacks on members of the Jordanian security forces and foreign trainers. Earlier this year, Jordanian security forces engaged in a deadly shootout with suspected ISIS sympathizers in a northern Jordanian town.

Last month, three American soldiers were killed in a shooting attack while working for the CIA in Jordan training Syrian rebels. The three came under fire while driving into the base.