Jordanian security forces killed four gunmen following a shootout on Sunday that killed nine people including five police officers and a Canadian tourist in the southern city of Karak, officials there said.
Daesh on Tuesday claimed responsibility for the attack.
Large quantities of explosives, suicide belts, and weapons were seized in a hideout after the gunfight.
"When we are in a region engulfed with fire from every side you expect that such events happen," said government spokesman Mohammad al Momani.
— Aüd™ (@CodeAud) 18 December 2016
The stand-off took place at a Crusader castle, where the gunmen fled after an earlier shootout at a residential building in the city, injuring at least 34 people, including two foreign nationals.
Witnesses said the bloody exchange of gunfire lasted for hours. Police first rescued 10 tourists trapped inside the historic Kerak Castle, when the gunmen went in.
A former government minister from Karak, Sameeh Maaytah, said there were signs militant groups 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.
The attack is one of the bloodiest ones in recent memory of Jordan, which is one of the few Arab states that have taken part in a coalition-led air campaign against Daesh in Syria.