After firing at police officers at two locations, gunmen moved into an ancient castle popular with tourists in the city of Karak, Jordan's Public Service Directorate said.
Security forces surrounded the castle and an hourslong standoff occurred. The PSD issued a statement around 11:30 p.m. (4:30 p.m. ET) saying the siege had ended with four terrorists killed inside the castle.
Seven members of security forces, two Jordanian civilians and a Canadian tourist were killed, the PSD said. Thirty-four people were wounded, including 15 members of security forces, 17 Jordanian civilians and two foreign tourists.
The PSD said officers combed the structure, a 12th-century, crusader-era fortress about 132 kilometers (82 miles) south of the capital of Amman, and found many automatic weapons.
They also found explosives, including suicide belts, in a house they raided in al-Qatraneh, where the shooting started on Sunday
'Region ... on fire'
Authorities have not identified the gunmen or what group they belonged to, if any. But Jordan's minister of state for media affairs, Mohammed al-Momani, told state TV the attack was a "cowardly terrorist attack."
He said Jordan "is part of a region that is on fire, packed with terrorist organizations and it (Jordan) will continue to be able to solidify its security and stability, and overcome this incident as it overcame other incidents in the past."
Jordan is a key US ally that has foiled several terror plots. The country has not suffered as much violence as other Arab nations, especially Syria and Iraq. Some people sent tweets about Jordan using the hashtag "#oasis_of_stability."
Speaking on CNN, Jordan's former deputy prime minister and current Sen. Ayman al-Safadi said attacks like this are rare in Jordan.
"Our security forces have been extremely able at keeping those operations away from our country, but as everybody knows, you're dealing with people who just want to kill," he said.
Shooting at police
The violence began when a police patrol came under gunfire as it responded to a report in al-Qatranah, about 40 kilometers (25 miles) away from Karak. Two policemen were injured and the attackers fled in a vehicle, the statement said.
Shortly after, gunmen fired at another police patrol in Karak and then at a police station from inside the castle overlooking the town.
Reuters reported the gunmen had holed up in the castle, citing police and security sources who said other tourists were believed to be trapped inside. Jordanian officials have not said if hostages were taken.
Nasser Judeh, Jordan's deputy prime minister and minister of foreign affairs, tweeted: "Tragic day today. #Jordan remains resilient and tough. God rest the souls of our fallen in eternal peace. #oasis_of_stability"
Unrest hurt tourism
Several attacks have occurred this year in Jordan.
In June, at least six members of Jordan's security forces on the Syrian border were killed
in a suicide car bombing launched from the Syrian side in what the government suspects was an attack by ISIS militants.
Jordan has increased security around tourist sites in recent years because because instability in the region has hurt the tourism industry. The Karak castle is a key tourist site in central Jordan.
The US Embassy in Amman said:
"We extend our hope for a full and speedy recovery to all the wounded. The United States remains steadfast in our commitments to Jordan, one of our closest allies and partners, and reiterates that such attacks will only reinforce our collective resolve to create a more secure and stable region and world."