An official statement said the four assailants, who shot at police targets in the town before heading to the Crusader-era castle, carried automatic weapons. Large quantities of explosives, weapons and suicide belts were seized in a hideout, the statement said.
A Canadian woman, three other civilians and five police officers were among the nine killed during the exchange of gunfire between the assailants and security forces.
At least 29 people were hospitalised, some with serious injuries.
Earlier, government spokesman Mohammad al-Momani said a manhunt to “eliminate” the gunmen had entered its final phase.
Jordan’s position made it vulnerable to spillover of violence, Mr Momani said.
“When we are in a region engulfed with fire from every side you expect that such events happen,” the official said.
Witnesses said exchanges of fire continued for several hours between the gunmen and security forces. Police said earlier they had rescued 10 tourists and trapped inside the historic site when the gunmen went into the castle.
A former government minister from Karak city, Sameeh Maaytah, said there were signs Islamist militants may have been behind the attack.