DAKAR, Senegal — A masked gunman opened fire on a restaurant in Mali’s capital, Bamako, early Saturday morning, killing at least two Europeans — a Frenchman and a Belgian — and three Malians.

The gunman sprayed the restaurant, La Terrasse, with bullets, firing indiscriminately, according to residents and officials. A ranking security official said two people had been arrested in connection with the attack.

“This was a terrorist attack. It’s absolutely clear,” said the security official, an army officer who requested anonymity because he was not authorized to speak publicly. The attack took place in Hippodrome, a neighborhood of the capital that contains a number of bars and restaurants frequented by foreigners.

The Mauritanian news website Al-Akhbar said Saturday that Al Mourabitoun, a group formed by extremists who split off from Al Qaeda, claimed responsibility for the attack, Reuters reported. A video sent to the website by the group said the attack was in reprisal for the killing of Ahmed al-Tilemsi, one of the group’s senior commanders, by French troops in December, Reuters said. The group’s leaders include Mokhtar Belmokhtar, a former commander of the regional Qaeda branch.