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

The Navy SEAL raid in Yemen last week had a secret objective — the head of al Qaeda in the Arabian Peninsula, who survived and is now taunting President Donald Trump in an audio message.

Military and intelligence officials told NBC News the goal of the massive operation was to capture or kill Qassim al-Rimi, considered the third most dangerous terrorist in the world and a master recruiter.

But while one SEAL, 14 al Qaeda fighters and some civilians, including an 8-year-old girl, were killed during a firefight, al-Rimi is still alive and in Yemen, multiple military officials said.

On Sunday, al-Rimi — who landed on the United States' most-wanted terrorist list after taking over al Qaeda's Yemen affiliate in 2015 — released an audio recording that military sources said is authentic.

"The fool of the White House got slapped at the beginning of his road in your lands," he said in an apparent reference to the Jan. 29 raid.

Qassim al-Rimi, the head of al Qaeda in the Arabian Peninsula AQAP video via Reutes

It's not clear whether al-Rimi was at the al Qaeda camp but escaped when SEAL Team 6 and United Arab Emirates commandos descended, whether he happened to be elsewhere, or whether he was even tipped off.

The White House, the Pentagon and U.S. Central Command had no comment on Monday, but issued a series of denials on Tuesday.

The Pentagon's chief spokesman, Navy Capt. Jeff Davis, disputed that al-Rimi was the target of the raid.

"I can tell you it’s not true," he said, adding that the military “never had any hope, intention or plan" of killing or capturing the AQAP leader in the operation.

A spokesman for U.S. Central Command, which is responsible for operations in the Middle East, said they had not expected to find al-Rimi at the encampment.

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

"There was no discussion of al-Rimi potentially being at that objective. We didn’t expect to see him there. We didn’t plan for him to be there, and this was not a raid that had anything to do with targeting that individual," Col. John Thomas said.

"The objective was site exploitation to find out more about how AQAP operates, functions, and how they communicate with each other.”

White House Press Secretary Sean Spicer said during a briefing that the raid was "highly successful."

"The goal of the raid was intelligence gathering and that's what we received and that’s what we got and that’s why we can deem it a success," he said.

A senior White House official, however, said that al-Rimi had been at the target site in the past and "the possibility of any capture drove the highest level deliberations."

U.S. Central Command — which received a visit from Trump on Monday — was not the only player involved. The Special Operations Command, which oversees global counter-terrorism military operations, and the CIA also had key roles in the mission, according to multiple military sources. The CIA declined comment.

"These types of missions have many tracks and are part of many worlds outside of the Pentagon," the senior White House official said. "This was a high-risk mission demanding the president's approval."

NBC News analyst Juan Zarate, a national security adviser in the administration of former President George W. Bush, said that even though the raid did not neutralize al-Rimi, it could still yield smaller victories.

Related: AQAP Leader Qassim al-Rimi Is Key Terrorist Recruiter

"Certainly, if the goal is to capture the leader of al Qaeda in the Arabian Peninsula, that didn't happen. It wasn't successful in that regard," he said.

"On the other hand, a number of al Qaeda leaders were killed and al Qaeda was disrupted, at least in terms of that cell. They understand that the U.S. is willing to lean forward, and perhaps they're being deterred or disrupted in their activities.

"And we may have collected incredibly valuable intelligence that will lead to further disruptions and further counterterrorism activities down the road," Zarate said.

Military officials told NBC News that it was the prospect of taking out al-Rimi that convinced the U.S. chain of command that the mission was worth the risk.

Preparation spanned two administrations. After the election, the Pentagon presented President Barack Obama's team with a broad plan to accelerate U.S. counterterrorism operations in Yemen, and the Obama administration referred the proposal to the incoming Trump team.

After two months of military preparation increasingly focused on the opportunity to capture al-Rimi, Trump was told by Defense Secretary James Mattis and the chairman of the Joint Chiefs of Staff that his capture would be a "game changer," according to a senior White House official with direct knowledge of the discussions.

An image released by a Yemeni organization purports to show a building damaged in the U.S. raid in Yemen to capture or kill Qassim al-Rimi. National Organization of Drone Victims

In making their case, they told Trump that they doubted that the Obama administration would have been bold enough to try it, this official said.

The so-called "package" for the mission was larger than any counterterrorism strike since the 2011 killing of Osama bin Laden: two dozen SEALs, backed up by 30 to 40 other Americans on the ground and in the air. A half-dozen Yemeni soldiers and a dozen commandos from the United Arab Emirates who had developed the intelligence leading to the target were also involved, and a Marine Corps Quick Reaction Force was waiting offshore, multiple officials said.

A senior U.S. intelligence official has told NBC News that "almost everything went wrong" once the raid got underway. Occupants of the targeted house were alerted by something — possibly a barking dog, a drone crash or walkie-talkie chatter, U.S. officials said.

The raiding force on the ground came under fire, and fighting erupted around houses where women and children were staying, with some armed women firing on the U.S. and Emirati forces, a senior military official told NBC News.

Chief Petty Officer William 'Ryan' Owens. Capt. Jason Salata / Naval Special Warfare Command

Chief Petty Officer William "Ryan" Owens of SEAL Team 6 was mortally wounded, and an MV-22 Osprey called in as backup had a hard landing and was rendered useless. A pair of Harrier jets and a pair of helicopter gunships arrived, attacked the encampment and destroyed the Osprey, the military official said.

The Pentagon later acknowledged that civilians were killed, possibly including children. The dead included Nawr al-Awlaki, 8, a U.S. citizen through her father U.S.-born father, radical cleric Anwar al-Awlaki, who was killed in a 2011 airstrike in Yemen.

After the raid, White House Press Secretary Sean Spicer said it had been "a successful operation by all standards," and the Pentagon released a statement that said U.S. forces had captured "materials and information that is yielding valuable intelligence."