AMMAN, Jordan — Three officers of the Jordanian intelligence service and two other employees of the service were killed on Monday in a Palestinian refugee camp near the capital, Amman, in what the government said was a terrorist attack.

The government has opened an investigation into the assault, which took place around 7 a.m. at an intelligence office in the Baqaa refugee camp, which was set up after the Arab-Israeli war of 1967 and is the largest in the country.

The attack, on the first day of the holy month of fasting known as Ramadan, struck in a country that has remained relatively stable despite being surrounded by conflicts.

“By attacking this office today, the terrorists want to send a message that they can attack at the heart of security in Jordan,” said Hassan Abu Hanieh, a Jordanian expert on Islamist groups.