BAQAA REFUGEE CAMP, Jordan -- An assailant with an automatic assault weapon attacked a local office of Jordan's national intelligence agency Monday, killing four guards and a receptionist in what the government called a lone-wolf "terrorist attack."

The gunman was arrested hours after the early morning shooting, which took place on the first day of the Muslim holy month of Ramadan.

In his initial comments, government spokesman Mohammed Momani suggested Islamic militants were behind the attack, saying those involved were "criminal elements that don't represent our moderate religion."

After the arrest of the assailant, Momani said it was a lone-wolf attack but that the investigation was continuing.

Get Breaking News Delivered to Your Inbox

Such attacks are relatively rare in Jordan, even though the pro-Western kingdom is on the front line in the military campaign against Islamic State of Iraq and Syria (ISIS) extremists who control large areas of neighboring Syria and Iraq.

The shooting targeted a two-story security compound on the edge of the Palestinian refugee camp of Baqaa, near the capital, Amman.

The shooting attack took place before 7 a.m., said Momani. The assailant, firing from an automatic weapon, killed four guards and a receptionist, and then fled the scene.

The targeted security office faces Baqaa camp, which was established almost half a century ago for Palestinian refugees displaced in the conflict with Israel.

The camp has a population of tens of thousands, including many Syrian refugees who have settled there since the start of the Syria conflict in 2011.

A highway separates the security compound and the camp.

Several hours after the attack, the access road to the security compound was closed. Security agents were visible outside the building, including masked members of the counter-terrorism squad.

Monday's attack came three months after Jordanian special forces clashed with ISIS-linked gunmen at a hideout in the northern Jordanian city of Irbid. Seven suspected Islamic State activists and a Jordanian officer were killed. The ISIS cell had planned attacks on military and civilian targets in the kingdom, officials said.

Over the past two years, since IS group's swift land gains in Syria and Iraq, Jordan has cracked down on suspected sympathizers to prevent the extremists from recruiting inside its borders.

Several hundred Jordanians have been sentenced to prison by special military courts for expressing support for ISIS on social media.

Jordan is part of the U.S.-led military campaign against ISIS.