Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The U.S. Special Forces unit that came under attack in Niger earlier this month had been pursuing a senior militant, multiple U.S. officials told NBC News.

The officials did not provide the name of the target, whom one of the officials described as an ISIS recruiter. The soldiers did not succeed in catching him.

Marine Gen. Joseph Dunford, the chairman of the Joint Chiefs of Staff, told reporters Monday that the Green Berets set out on a reconnaissance mission, and that the intelligence suggested there was a low risk of contact with the enemy. He also said the military was investigating whether the mission changed as it unfolded.

One theory, said an official with direct knowledge of the military's investigation, is that the soldiers were gathering information about the target, and, after learning his whereabouts, decided to pursue him. A big question would then be whether the unit got authorization, and whether the risks were assessed.

It's also possible that the 30 Nigerien troops the Americans were accompanying decided to pursue the target, one official said.

NBC News reported Monday that military officials believe the unit was set up, and that residents in a village they visited provided information about their location to the militants who later ambushed them.

It was unclear, the officials said, whether the villagers tipped off the target the Americans were pursuing.

The Niger mission was carried out under the broader auspices of Operation Juniper Shield, a program initiated under the Obama administration and reauthorized under the Trump administration, according to multiple U.S. military officials. Juniper Shield is intended to "disrupt or neutralize" terror organizations affiliated with Al Qaeda and the Islamic State operating across North and West Africa, primarily through the killing or capturing of members of its senior and intermediate leadership.

A subset of this operation, Juniper Micron, is focused specifically on supporting the French counterterror and stabilization mission in Mali, Operation Barkhane.

Related: Niger Ambush Was Partly Result of 'Massive' Intelligence Failure, Says Official

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The primary target of all of these missions is a terrorist organization based in Mali and Libya known as Al-Mourabitoun.

Al-Mourabitoun isn't well known by the American public or policymakers, but the group and its affiliates have an extensive history of activity across West Africa and the Sahara. Al-Mourabitoun has been tied to a string of deadly attacks that have killed hundreds since the group's formation in 2013.

Those attacks have grown in sophistication while increasing in lethality and frequency.

Among them: a January suicide bombing against a military base in Gao, Mali, that killed 77; a March 2016 attack on a beach resort in Ivory Coast that killed 21; a January 2016 attack targeting foreigners in Burkina Faso that killed 30, including American missionary Mike Riddering.

A photo from the Department of Defense shows four U.S. soldiers killed in Niger: Staff Sgt. Bryan C. Black (Top-L), Sgt. La David Johnson (top-R), Staff Sgt. Dustin M. Wright (bottom-L), and Staff Sgt. Jeremiah W. Johnson (bottom-R). Dept of Defense / EPA

The group also seized a gas facility in Algeria in an attack that left 39 hostages dead in January 2013.

"We have seen Al Qaeda in the Islamic Maghreb and their affiliates expanding their reach from Northern Mali into central and southern Mali recently," said a spokesperson for Special Operations Command Africa, when asked whether there had been an increase in activity by Al-Mourabitoun or related groups in the area over the past several months.

On Oct. 4, the team of Green Berets, officially known as an Operational Detachment Alpha or ODA, was on its second field operation in Niger, according to two of the military officials. Part of 3rd Special Forces Group, it had recently replaced its predecessor, 10th Special Forces Group, for a six-month rotation in country. 10th Group had completed more than 20 similar missions in support of Juniper Shield with its Nigerien partners before its departure.

ODAs are U.S. Army Special Forces units that work with foreign militaries to build partnerships and enhance capabilities, often by conducting joint training missions or acting as a "force multiplier" by adding critical skills, such as intelligence coordination or directing air support.

Two of the American officials told NBC News that at least part of the mission on Oct. 3 and 4 was an intelligence-directed operation. The team was trying to verify a piece of single-source intelligence and had set up a meeting with an individual who promised further information.

Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff, briefs the media at the Pentagon on Oct. 23. Mark Wilson / Getty Images

Military officials told NBC News on Monday that they suspected that meeting may have been a set-up.

The target of the intelligence activity was the immediate circle of leadership surrounding a militant named Adnan Abu Walid al-Sahraoui, a veteran insurgent originally from Laayoune in Western Sahara, according to two sources.

"We can't discuss specific targeting details for operational security reasons," an official from Special Operations Command Africa told NBC News.

Al-Sahraoui is affiliated with the insurgent group Al-Mourabitoun, which was led for many years by Mokhtar Belmokhtar, aka the "Marlboro Man." Belmokhtar has been reported killed numerous times, most recently in Libya in June 2015 from a U.S. airstrike.

Al-Mourabitoun — or at least one of its affiliate brigades — now appears to be led by al-Sahraoui, who on May 14, 2015, released an audio message pledging allegiance to ISIS. Several days later, Belmokhtar issued a message rejecting this pledge and affirming the group's loyalty to Al Qaeda. However, Belmokhtar was reported dead in an apparent U.S. airstrike a month later, but the group has not acknowledged that he was killed and there is no way to independently confirm his fate.

ISIS publicly accepted al-Sahraoui's pledge of allegiance in 2016.

Wounded Malian troops receive medical treatment after a suicide bombing at a base in Gao, Mali, on Jan. 18, 2017. Yacouba Cisse / AP file

Because of the varying accounts of who is in charge of Al-Mourabitoun, and precisely what its goals and loyalties are, the subgroup operated by al-Sahraoui is sometimes referred to by other names: One of these is the Islamic State of the Greater Sahel, abbreviated ISGS — or sometimes ISIS-GS.

When asked whether the Pentagon had details about the perpetrators of the ambush against the Americans on Oct. 4, Dunford confirmed ISIS was a primary suspect.

"It was an ISIS affiliated group," the general said. "ISIS and Al Qaeda try to leverage local insurgencies and connect those insurgencies globally."

"Is this a dangerous area? Yeah," Dunford said. "We're there because ISIS and Al Qaeda are there."