The Associated Press

KARAK, 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.

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

The 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 central town of Karak, 87 miles south of the capital, Amman.

The killing of the Canadian tourist could further hurt Jordan’s embattled tourism sector, which has declined sharply since the Islamic State group seized large parts of neighboring Syria and Iraq two years ago. Another Canadian was injured in the shooting, said Canada’s Global Affairs spokesman John Babcock.

“Canadian officials in Amman are actively working with local authorities to gather additional information and are providing consular assistance to Canadians at this difficult time,” he said.

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 fort, wounding members of the security forces. The statement said five or six gunmen were believed to be holed up inside the castle.

Jordan faces homegrown extremism, with hundreds of Jordanians fighting alongside Islamic State militants in Iraq and Syria 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 the Islamic State.

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 Islamic State sympathizers in a northern Jordanian town.

In the most recent incident, three U.S. military members were killed in a shooting outside an air base in southern Jordan in November. The three were in Jordan on a training mission and came under fire while driving into the base.