CAIRO — Jordan’s government on Tuesday barred the country’s news media from publishing reports on a shooting at an intelligence office near Amman that killed five people and raised fears that militants had been able to penetrate one of the region’s most powerful and ruthlessly effective counterterrorism agencies.

Jordanian officials cast the shooting, which occurred on Monday, as an “isolated and individual act,” and said they had arrested the killer. There were no immediate claims of responsibility from militant groups like the Islamic State that might suggest the attack, which killed three intelligence officers and two other employees at the office, had had broader organizational support.

Local news reports said the suspect might have been detained at the intelligence building sometime before the shooting — suggesting revenge as a possible motive.

The secrecy order, which prevented the publication of any news on the assault, including on social media, showed that the attack had struck a nerve in Jordan — momentarily denting official boasts of successes in thwarting militant attacks and, more generally, in protecting the country from the kind of violence seen in nearby Syria and Iraq.