U.S. efforts to combat terrorists based on the African continent are running into a myriad of problems, perhaps none so vexing, or dangerous, as the constantly shifting alliances and aims of the terrorist fighters themselves.

No longer beholden to one group or ideology, or even to the highest bidder, these terror operatives are steadily blurring the lines dividing one group from another.

The result, according to Western and African defense and intelligence officials, is new type of higher-level terror operative, willing to work for competing, brand-name terror groups like al-Qaida and Islamic State, sometimes simultaneously.

"You need a bit of a decoder ring and you really have to keep up on it to figure out what one group of fighters is currently aligned with what other group," Christopher Maier, director of the Defeat ISIS Core Task Force at the U.S. Defense Department, told VOA.

"They do mergers and acquisitions basically on a regular basis," he said. "Most of the capability in terms of fighters and leaders moves as it serves their local interests."

As a result, terror attacks can be harder to attribute, with successes at times possibly the result of help or planning from more than one group, even from both al-Qaida and IS.

Such attributions have even become the source of disagreements among U.S. counterterrorism agencies and officials.

Tunis attack

One example is the March 2015 attack on the Bardo Museum in Tunis that killed 22 people.

U.S. defense and intelligence officials pinned responsibility on IS. Two months later, a U.S airstrike targeted a prime suspect, IS planner Noureddine Chouchane, a Tunisian national who had also been moving IS fighters through IS camps in Libya to other countries.

"Chouchane's removal will eliminate an experienced facilitator and is expected to have an immediate impact on ISIL's ability to facilitate its activities in Libya," said then-Pentagon press secretary Peter Cook, using an acronym for Islamic State.

While Chouchane may have been the prime suspect, it was clear he was not working alone.

FILE - A view of the Serbian Embassy in Tripoli, L FILE - A view of the Serbian Embassy in Tripoli, Libya, Feb. 21, 2016. The day before, Libya's internationally recognized government condemned a U.S. airstrike west of Tripoli in Sabratha, believed to have killed Islamic State operative Noureddine Chouchane and dozens of others, calling it a violation of Libyan sovereignty. The strike also killed two kidnapped Serbian Embassy employees. FILE - A view of the Serbian Embassy in Tripoli, Libya, Feb. 21, 2016. The day before, Libya's internationally recognized government condemned a U.S. airstrike west of Tripoli in Sabratha, believed to have killed Islamic State operative Noureddine Chouchane and dozens of others, calling it a violation of Libyan sovereignty. The strike also killed two kidnapped Serbian Embassy employees.

In the time since the strike targeting Chouchane, some U.S. officials came to believe he had help from another terror facilitator familiar to African counterterror officials, Wanas al-Faqih.

Only that was a problem. Whereas Chouchane was working for Islamic State, Faqih was known for his work for IS's northern African rival, al-Qaida in the Islamic Maghreb (AQIM).

"Wanas al-Faqih is an AQIM associate who planned the March 18, 2015, Bardo Museum attack in Tunis, Tunisia, that killed at least 20 people," the State Department said in a statement this past January, when he was named as a specially designated terrorist.

U.S. counterterrorism officials outside the State Department quickly pushed back.

"The 18 March 2015 Bardo Museum attack in Tunis was conducted by ISIS-aligned Tunisians operating out of Sabratha, Libya," a senior counterterrorism official told VOA. "AQIM was not involved with planning the attack."

Yet State Department officials insisted Faqih was involved, just that he was not acting on behalf of the al-Qaida affiliate.

"Wanas al-Faqih is dual-hatted," a State Department counterterror official clarified to VOA. "He has worked for both AQ [al-Qaida] and ISIS."

Fluid terror landscape

The terror landscape in Africa has always been fluid. Some counterterrorism officials have at times described various hot spots on the continent as jihadist resorts, where low-level fighters can rest and resupply before joining up with a new terror group.

Yet even as IS and al-Qaida compete for followers and affiliates, the willingness for higher-ranking jihadists to be "dual-hatted" has taken some by surprise, especially since it has long been discouraged at the very highest levels of both terror organizations.

"It's been a long-evolving process," said Joseph Siegle, director of research at the Africa Center for Strategic Studies, a U.S. Defense Department institution.

FILE - French soldiers leave a hangar at the Malia FILE - French soldiers leave a hangar at the Malian army air base in Bamako, Jan. 14, 2013. France had poured hundreds of troops into Bamako at the time, carrying out air raids in a vast desert area seized the year before by an Islamist alliance grouping al-Qaida's north African wing, AQIM, and Mali's homegrown MUJWA and Ansar Dine militant groups. FILE - French soldiers leave a hangar at the Malian army air base in Bamako, Jan. 14, 2013. France had poured hundreds of troops into Bamako at the time, carrying out air raids in a vast desert area seized the year before by an Islamist alliance grouping al-Qaida's north African wing, AQIM, and Mali's homegrown MUJWA and Ansar Dine militant groups.

That has been especially true in parts Mali and Burkina Faso, where AQIM has been trying to expand since 2012, at one point taking major Malian cities like Kidal, Gao and Timbuktu with the help of seminomadic Tuareg rebels.

Despite that initial success, analysts say, AQIM was never able to solidify support among local jihadists.

"These groups are broken off, they re-form in different configurations, they change names," said Siegle. "Sometimes there's rivalry, sometimes there's cooperation."

And that fluidity extends up the chain of command.

"We see a lot of exchanges happening, either leaders going from one group to another or creating their own group when they're not happy with the group they were in," he said.

Problematic counterterror response

The constant state of flux on the ground has made the fight against the jihadist groups more difficult, both for African states and the U.S.

"Most people actually think that the threat is ended once you close them inside cells. That's wrong," Ambassador Mohamed Salah Tamek, delegate general of Morocco's Penitentiary and Reintegration Administration, said during a visit to the U.S. late last year.

"The point is not to put these offenders in prison but rather convincing them to disengage from religious extremism," he said, adding the key is not to take on the group or brand but rather the underlying thinking.

"These people are understanding religion differently," Tamek said. "The religious discourse is misleading them, or they're being misled by wrong ideas about jihad."

For the United States, which has about 7,500 troops and contractors in Africa, the challenge is just as daunting, as evidenced by the October 2017 ambush of a U.S. team in Niger by an IS affiliate that left four Army Special Forces soldiers dead.

FILE - An honor guard carries the coffin of U.S. A FILE - An honor guard carries the coffin of U.S. Army Sergeant La David Johnson, who was among four Special Forces soldiers killed in Niger, at a graveside service in Hollywood, Fla., Oct. 21, 2017. FILE - An honor guard carries the coffin of U.S. Army Sergeant La David Johnson, who was among four Special Forces soldiers killed in Niger, at a graveside service in Hollywood, Fla., Oct. 21, 2017.

While a months-long investigation into the incident found the joint U.S.-Nigerien mission was plagued by problems up and down the chain of command, it also revealed a jihadist threat that was more vibrant and capable than previously thought.

Unseen magnitude, capability

"They knew activities went on there, but they had never seen anything in this magnitude — numbers, mobility and training," General Thomas Waldhauser, commander of U.S. Africa Command, told Pentagon reporters earlier this month.

Since the ambush, U.S. Africa Command has not only increased the firepower available to its forces on the ground but also has ramped up its use of drones and other surveillance to get a better sense of the size and composition of the jihadist groups they are facing.

"ISIS-GS [Islamic State — Greater Sahel] is one of the many violent extremist groups in that particular region of the Mali-Niger border," Waldhauser said. "They change allegiances quite frequently, because there's underpinnings to AQIM and a group called JNIM, Jama'at Nasr al-Islam wal Muslimin."

The fluid state of play is also forcing U.S. and African forces to put a greater premium on tracking individual leaders, like Doundou Chefou, currently a key player in the IS affiliate in Niger who was being targeted by U.S. and Nigerien forces at the time of the October 2017 ambush.

"These groups tend to combine around personalities and different, more localized interest," the Defeat ISIS Core Task Force's Maier told VOA.

The way they identify or brand themselves has increasingly less to do with ideology and more to do with pure convenience.

"Sometimes it behooves them more on what they're trying to achieve to put the ISIS brand on them, much as in the past it was an al-Qaida-type brand," Maier added. "Opportunistic is kind of how we tend to think of those groups down there."

VOA's Carol Guensburg contributed to this report.