Security services in Jordan took part in an overnight firefight with heavily armed Islamic state group militants Wednesday, thwarting what were believed to be imminent attacks on civilians and military targets. The operation, which took place at a town near the Syrian border, represents one of the biggest by the Middle Eastern country against sleeper cells of the organization, aka ISIS, according to Jordan’s security services.

"After diligent and detailed intelligence gathering, the intelligence department was able soon to thwart a criminal and destructive plot linked by the terrorist Daesh group aimed at destabilizing national security," a statement from Jordan's security services said, according to a Reuters report. "Daesh" is yet another name for the extremist organization.

Stationary tanks at the border crossing between Jordan and Syria. Soldiers stand guard on a tank at the Jordanian-Syrian border, near Mafraq, Jordan, Aug. 16, 2015. Photo: REUTERS/Muhammad Hamed

Militants were found armed and wearing suicide belts in a hideout in the northern town of Irbid. During the firefight, which lasted from Tuesday night until dawn Wednesday, seven militants and one security officer were killed. Jordanian officers seized weapons, munitions and explosives they believed would have been used in a major terror plot. 

Security officers said that as many as two dozen soldiers from the country's special forces were involved in the fighting, which took place near a Palestinian refugee camp in the middle of the town. While some militants surrendered, others fought back, injuring five police officers, according to the statement. 

"They showed heavy resistance with automatic weapons, and so the security forces dealt with the situation with the necessary force," it said.

Jordanian Prime Minister Abdullah Ensour said the operation had contributed to its goal of thwarting terrorists recruited by groups such as ISIS or the Nusra Front, which is the Syrian branch of al Qaeda. Along with arresting and charging those believed to be involved with the groups, the country’s security officials have also cracked down on people showing sympathy for extremists on social media.

Despite relative peace in Jordan, the five-year-long Syrian civil war has seen hundreds of thousands of Syrian refugees flee across its borders, putting pressure on the country’s infrastructure and security services.