KABUL — The Afghan president’s office said its spy agency believes a foreign intelligence service, not the country’s main militant groups, was behind the attack on a Kabul hotel last week that killed nine people, including two children and four foreigners.

A statement from President Hamid Karzai’s office said the spy agency briefed Afghanistan’s top security officials.

‘‘The attack on the Serena Hotel was a direct attack by an intelligence service outside the country,’’ the agency said.

It did not specify which country was purportedly responsible for the assault, but Afghanistan routinely accuses Pakistan of sending militants across the border to wage attacks. Pakistan did not comment on the allegations.


Afghanistan’s National Security Council was also told that a Pakistani diplomat was spotted filming inside the Serena Hotel ‘‘a while ago,’’ seeming to suggest that the incident was connected to Friday’s horrific assault in which four gunmen, their small pistols hidden in their shoes, slipped passed the hotel security.

Once inside the hotel, they opened fire in a restaurant.

A senior reporter of Agence France-Presse, Sardar Ahmad, died in the rampage along with his wife and two young children. Two Canadians, an American, a Paraguayan, and a fifth Afghan were also among the dead. The American has not been publicly identified. Sardar and his family were buried Sunday.