With the carnage left behind, the attacks are pummeling the economy and psyche of the region. Tourism is declining, hurting hotels that are already spending more on security. Governments worry that it will be harder to lure international companies, and organizations based in nations that have been hit are finding recruiting difficult.

American defense officials worry that the group’s push into new areas could have far-reaching ramifications.

If the authorities chase the militants south, they risk letting up on patrols in the northern part of Mali. That stretch of sparsely populated desert, lined by lightly controlled borders, could become a new haven for the thousands of fighters with the Islamic State in Libya. The Islamic State appears to be pushing south, too, according to American military experts on counterterrorism in Africa.

Al Qaeda in the Islamic Maghreb has had international ambitions since the central leadership of Al Qaeda bestowed member status on it in 2006. The group showed its muscle in 2007 with a major attack on a United Nations compound in Algiers. Then, in 2012, its militants helped take control of roughly 300,000 square miles of terrain in northern Mali.

Among the group’s most notorious figures is Mokhtar Belmokhtar, a one-eyed Algerian operative who has endeared himself to locals by setting up medical clinics and helping with livestock. Mr. Belmokhtar has been targeted in strikes and rumored to be dead, but many analysts believe he is alive. He has sometimes argued with the leadership of Al Qaeda and its West African branch, resulting in a series of mergers and splits, including the creation of groups loyal to him.

After French troops swooped in to beat back the militants in Mali, Mr. Belmokhtar struck back in devastating fashion. He branched out with a new group, Al Mourabitoun, and seized more than 600 employees of a gas plant in Algeria, killing 38 people.