Washington (CNN) New details have emerged surrounding Sunday's deadly joint US-United Arab Emirates counterterrorism raid on an al Qaeda compound in Yemen, shedding light on why the mission happened when it did -- and what went wrong.

The military said the operation was geared toward collecting as much intelligence on the terror group as possible in order to facilitate future raids and strikes against al Qaeda down the road and prevent terror attacks.

The raid was greenlit by President Donald Trump shortly after taking the oath of office, but multiple officials told CNN the mission had been planned months in advance and had been briefed to then-President Barack Obama.

Both defense and Obama administration officials said the operation was never vetoed by Obama and that "operational reasons" were why it was pushed back after January 20 and why Obama left the task of authorizing the raid to his successor.

SEALs detected during mission

One such operational reason: The need for a moonless night to help provide the cover of darkness for the Navy SEALs undertaking the raid on the al Qaeda headquarters located in the al Bayda Governorate in Yemen.

According to one diplomatic source, after being briefed on the operation, Trump approved the mission "fairly quickly."

The raid involved elite US Navy SEALs and special forces from the UAE, with armed drones flying overhead in support, according to officials from several countries.

But as the combined force approached the al Qaeda compound, it was detected and an intense firefight broke out that saw Chief Petty Officer William "Ryan" Owens receiving a fatal wound and three additional SEALs being wounded.

During the gun battle, which featured small arms fire, hand grenades and close air support strikes from US aircraft, al Qaeda fighters -- including some female combatants -- took up firing positions on the roof of a nearby building and the US troops came under fire, calling in an airstrike against the building, which likely led to civilian casualties, a US official told CNN.

The civilian casualties were "caught up in aerial gunfire that was called in to assist US forces in contact against a determined enemy that included armed women firing from prepared fighting positions, and US special operations members receiving fire from all sides," US Central Command, which oversees military forces in the region, said in a statement Wednesday.

"The raid resulted in the seizure of materials and information that is yielding valuable intelligence to help partner nations deter and prevent future terror attacks in Yemen and across the world," the statement continued.

The Pentagon said 14 al Qaeda fighters were killed in the battle. Central Command said an internal review team "concluded regrettably that civilian non-combatants were likely killed in the midst of a firefight" during the raid, adding that "casualties may include children."

The statement said than an assessment was ongoing to determine the exact number of civilian casualties.

Yemeni officials said 13 civilians were killed in the raid, including 8-year-old Nawar Anwar Al-Awalki, the daughter of Anwar Al-Awalki, the US-born cleric and al Qaeda in the Arabian Peninsula leader. Anwar Al-Awalki, who directed attacks against the US, was killed in a drone strike in 2011.

"Al Qaeda in the Arabian Peninsula has a horrifying history of hiding women and children within militant operating areas and terrorist camps, and continuously shows a callous disregard for innocent lives," US Col. John J. Thomas, a spokesman for Central Command, said in the statement. "That's what makes cases like these so especially tragic."

The challenges of military operations in Yemen were on display in 2014, when US commandos attempted to rescue western hostages, including American journalist Luke Sommers, held by the terror group. That operation was similarly detected by al Qaeda fighters and the hostages were fatally shot during the raid.

In the latest operation, US Marines aboard the USS Makin Island in the Gulf of Aden were standing by to assist and multiple MV-22 Osprey aircraft were sent to rendezvous with the Navy SEALs and help evacuate the wounded.

But one of the Osprey's suffered a technical malfunction at the landing zone and was forced to make a "hard-landing," which resulted in three US service members being injured, none of them seriously. The aircraft was deemed unrecoverable and the military conducted an airstrike to destroy the Osprey in order to prevent its technology from falling into enemy hands.

Secretary of Defense James Mattis was attending the Alfalfa Dinner, an elite social gathering in Washington, at the time of the raid and was informed that the US had suffered casualties during the operation. Mattis left the event to help address the situation.

US defense officials told CNN that reams of intelligence were recovered during the operation, including computer hard drives.

While the assessment of that information is still ongoing, officials believe it is highly possible that information contained within could help prevent future terror attacks by al Qaeda in the Arabian Peninsula, which is thought to be the most capable of al Qaeda's franchises and was behind the 2015 terrorist attack on the Charlie Hebdo offices in Paris.

'A success by all accounts'

Trump was quick to label the raid a success, issuing a statement Sunday saying it acquired "important intelligence that will assist the US in preventing terrorism against its citizens and people around the world," while expressing condolences for the life lost and wishing the wounded a speedy recovery.

Trump called Owens' family Tuesday to express his condolences personally and went to Dover Air Force base Wednesday to be with the fallen soldier's family when his body was returned to the US.

Military analysts who spoke with CNN noted that the complexity of this type of mission, saying that at least from a tactical standpoint, the intelligence gathering mission could be deemed a success.

"In a very difficult, very austere environment, our special forces were able to do something that was very very significant," retired Col. Cedric Leighton told CNN.

Speaking to the US casualties suffered, retired Maj. Gen. James "Spider" Marks said, "Those kinds of things will happen in operations like this."

"There is clearly a risk assessment. You mitigate the risk as best you can -- there will often be casualties. It's just the nature of this business," Marks added.

"The mission was a success by all accounts," retired Lt. Gen. Mark Hertling told CNN Wednesday.

But the raid was also met with criticism by outside groups, with the Brussels-based International Crisis Group issuing a statement Wednesday calling the operation "a good example of what not to do."

"The use of US troops and the high number of civilian casualties are deeply inflammatory and breed anti-American resentment across the Yemeni political spectrum that works to the advantage of" al Qaeda in the Arabian Peninsula, the statement added.

Raids becoming more common

Military raids aimed at gathering intelligence on terror groups to facilitate future raids and strikes in the future have become increasingly common in recent years and have featured in the fight against ISIS in Iraq and Syria.

"These types of missions occur many times a year. Their purpose is to generate understanding of their networks and disrupt them," a US defense official familiar with these types of raids told CNN.

The raids were considered critical to defeating al Qaeda in Iraq, the predecessor of ISIS, during former Gen. Stanley McChrystal's leadership of Joint Special Operations Command.

Trump's national security adviser, retired Army Lt. Gen. Michael Flynn, served under McChrystal at the time and lauded the raids in his recent book, "Field of Fight."

He wrote the raids would gather intelligence that would allow military intelligence officers to analyze the information and better understand those terror groups.

"Everyone could then pursue new linkages in the terror network, leading to new captures, new discoveries of documents, computes, and the like ... if the answers pointed to new action, that would be relayed back to tacticians and fighters," he said.