Washington (CNN) President Donald Trump first learned about a planned military raid in Yemen days before the mission actually took place, government officials told CNN, giving his conditional go-ahead to his top military brass over dinner in the White House residence.

The mission, which military officials said went off-track from the start, left Chief Petty Officer William "Ryan" Owens dead and three others injured. After putting out a statement that branded the assault of a heavily fortified Yemini compound a success, the Trump White House was left to defend the first military action ordered by the newly inaugurated commander in chief.

How Sunday's deadly joint US-United Arab Emirates counter-terrorism raid on an al Qaeda compound in Yemen was handed from the Obama to Trump administrations sheds light on the complications that occurred during the sometimes rocky transition of power and has led to a blame game between both camps.

Trump White House aides have defended the mission by saying that it was first considered and approved during Obama's time in office. But former senior government officials under Obama said the former President never signed off on the raid before leaving office.

While the military discussed various options for actions in Yemen, the 44th president felt such action "represented a significant escalation of US involvement in Yemen," as one senior government official under Obama said.

Trump first learned of the plan the morning of Wednesday, January 25, days after he had been inaugurated, a White House official told CNN. James Mattis, Trump's secretary of defense, had already approved the raid by the time Trump learned of it, the official added.

Michael Flynn, Trump's national security adviser, presented the President with a written memo about the planned raid in the morning and the two discussed it a number of times during the day, the official said. Trump then asked Flynn to arrange a meeting so he could solicit advice from Mattis and Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff.

Flynn, Dunford and Mattis laid out the scenario for Trump over dinner, explaining to the President -- who has no military experience -- that there are inherent risks with a mission like this.

"The paper presented and the verbal information presented made it very clear that this was not a risk-free operation, there were risks, there were dangers," said one White House official.

Trump's trio of top White House advisers -- chief of staff Reince Priebus, senior adviser Jared Kushner and counselor to the president Stephen Bannon -- were at the dinner, the White House official said, along with Vice President Mike Pence, CIA Director Mike Pompeo and Keith Kellogg, chief of staff at the National Security Council.

The 10 men sat in the residence, discussing the specifics of the raid and what could go wrong. A source close to Flynn said that Trump was "extremely active" and "asked a ton of questions" during the meeting.

Trump personally invited Priebus, Kushner and Bannon to the dinner. "They are entitled to be wherever the President wants them to be," the White House official said when asked about why politically minded aides were discussing the mission.

As the dinner wrapped up, Trump approved the raid, conditional on another round of meetings with deputies from the agencies. One official said Trump trusted Mattis' view of the situation, in part, because he reviewed the plan and approved it shortly after taking over at the Pentagon on January 20 -- the first day of Trump's presidency.

Discussed under Obama administration

During the Obama presidency, United States Central Command, under Gen. Joseph Votel, recommended the mission, in part, because US officials felt there was a need for a better intelligence picture of al Qaeda in the Arabian Peninsula, long considered to be the terror group's most capable franchise, a defense official told CNN.

This need was increased when troops from the UAE drove the organization from the port city of Mukalla, scattering its fighters into the more remote areas where they intermingled with local tribes. Sunday's raid was geared to better understand the nexus between regional tribal fighters and al Qaeda operatives.

That is why, the defense official said, the mission required boots on the ground, with US Navy SEALs taking the lead and UAE Special Forces providing support.

"A drone strike or bomb alone, while it may eliminate the threat, does not allow you to learn from that threat," US Navy Capt. Jeff Davis told reporters Thursday.

The operation was "carefully planned and very deliberately planned," Davis said.

Approved by Pentagon

The plan was first delivered to the Pentagon on November 7 when US Central Command asked Defense Department lawyers for review and approval. Legal experts sent it to the National Security Council on December 19, Spicer said at Thursday's White House briefing.

The legal review used the existing post-9/11 Authorization for Use of Military Force to provide the justification for the raid, the US military official said, and Spicer cast the raid as an Obama administration-approved mission.

"Clearly, that was under the last administration," Spicer said. "On December 19, the plan was approved by the Department of Defense and recommended that it be moved ahead."

But approval by the Pentagon and approval by the President are two different things.

A former Obama administration Defense official said that plan was "teed up" by the Pentagon and approved by military brass.

Those closer to the White House, though, did not see it that way.

"It wasn't something the President approved and said good to go," said a former Obama administration official. The plan was discussed at several levels, but never fully approved -- because such situations are remarkably fluid based on daily intelligence and conditions on the ground.

Ned Price, former Special Assistant to Obama and the National Security Council responded to Spicer's briefing by arguing his timeline of events was wrong.

"The specific operation in question was never presented to or considered by the Obama Admin for approval," he tweeted.

A separate senior government official involved in the Obama administration's NSC told CNN that the Defense Department worked up general proposals for an overall set of targets in Yemen that were then discussed among the agencies in the closing weeks of Obama's term.

"This particular raid was not discussed -- just the broad framework," said the former government official. "Moreover, no recommendation was made other than a recommendation to provide the next administration with the necessary information to make a decision after they had a chance to run their own deliberative interagency process."

Decision left to Trump

But a current White House official claimed the order did go through National Security Council reviews until January 6, when a National Security Council Deputies Committee meeting was called. Deputies from Defense, State, CIA and the National Security Council met and approved the raid, contingent on the need for a moonless night.

One issue: The next moonless night would not come until Trump -- not Obama -- was president, meaning the new commander in chief would have to consider the raid before going forward.

After Mattis was sworn in to lead the Pentagon on January 20 -- the same day Trump took the oath of office -- the order was presented to the new secretary of defense for the first time, the White House official said. Mattis reviewed the plan for four days and sent it back to the National Security Council -- with two pages of notes -- on January 24.

After the dinner meeting, which many saw as the official go ahead for the plan, the group of deputies -- which now under the Trump administration included KT McFarland, Trump's deputy national security adviser - met again January 26 and approved the order.

Trump officially signed off on the plan January 26, kicking it into high gear given the next moonless night was a mere four days away, the White House official said.

The raid

There was no intelligence indicating the presence of civilians when the raid started, according to military officials. Drones flew over the site during the entirety of the raid, giving military planners updates on the mission.

The operation was considered relatively risky by military officials and in order to mitigate the risk, US Marines aboard the USS Makin Island in the Gulf of Aden were standing by to assist. Multiple MV-22 Osprey aircraft, officials said, were sent to rendezvous with the Navy SEALs when they came under intense fire. Harrier jets and Cobra helicopters were also standing by to assist.

One of the Ospreys experienced a hard landing during the operation, making it inoperable, a defense official said. The Osprey was intentionally destroyed in place so that it couldn't be used by enemy combatants.

In addition to US military casualties, the London-based NGO Reprieve and a Sanaa-based human rights worker told CNN that at least 23 civilians were killed in the attack.

"The villagers feel very terrified by what happened," Mohammed al-Qawli, head of Yemen's National Organization for Drone Victims, told CNN, "They can't believe what happened. They feel the world has let them down. Sadness hangs over the whole area."

Mattis was attending the Alfalfa Dinner, an elite social gathering in Washington, at the time of the raid and was informed there that the US had suffered casualties during the operation.

Mattis left the event early to help address the situation.

"We believed it was worth the risk," said a US military official, who noted the operational commander on the ground in Yemen could have scrapped the mission at anytime. "It's a military assault. There's going to be risk."