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.
It made no mention of their identity or whether they belonged to any militant group, raising speculation they could have been tribal outlaws with a vengeance against the state rather than Islamic State fighters, who control parts of neighbouring Syria and Iraq.
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 hospitalized, 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, 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.
"This was a group that was plotting certain operations inside Jordan," Maaytah told pan-Arab news channel al-Hadath.
Video footage on social media showed security forces taking groups of young Asian tourists up the castle's steep steps to its main entrance as gunshots were heard overhead.
The castle is one of Jordan's most popular tourist attractions.
Prime Minister Hani al Mulki told parliament "a number of security personnel" had been killed and that security forces were laying siege to the castle. The Canadian government confirmed one of its nationals had been killed.
Police and witnesses said gunmen had earlier gone on a shooting spree aimed at officers patrolling the town before entering the castle, perched on top of a hill. They used one of the castle's towers to fire at a nearby police station.
Police said the gunmen had arrived from the desert town of Qatraneh nearly 30 km northeast of Karak city, a desert outpost known for smuggling, where many tribal residents are heavily armed and have long resisted state authority.
They had fled to Karak after an exchange of fire with the police at a residential building, security forces said.
Jordan is one of the few Arab states that have taken part in a US-led air campaign against Islamic State in Syria.
But many Jordanians oppose their country's involvement, saying it has led to the killing of fellow Muslims and raised security threats inside Jordan.
Several incidents over the past year have jolted the Arab kingdom, which has been relatively unscathed by the uprisings, civil wars and Islamist militancy that have swept the Middle East since 2011.
Last November three US military trainers were shot dead when their car failed to stop at the gate of a military base and was fired on by a Jordanian army member in an incident which Washington did not rule out political motives.