The Navy SEALs' attempted raid of an Al-Shabaab camp was thwarted over the weekend by one man outside the targeted compound who saw them setting up their position resulting in a firefight, officials tell NBC's Richard Engel. The SEALs retreated when fearing civilian deaths.

The team of less than two dozen Navy SEALs from Seal Team 6 huddled in one fast boat and headed toward the Somali shoreline under the cover of darkness in the early hours of Saturday morning.

Three more small boats with additional SEALs flanked the assault team’s craft, to provide back-up and assist with the planned extraction of an al Shabaab warlord named Ikrima.

According to multiple U.S. military sources, the lead boat landed, and the assault team hit the beach near the Southern Somali town of Barawe, headed for the fortified seaside compound of their target. U.S. intelligence had determined that Ikrima, one of two terror suspects targeted by the military in simultaneous raids thousands of miles apart this weekend, planned the terror group’s operations outside of Somalia.

Click here to read more about this weekend’s simultaneous U.S. raids on terror suspects in Libya and Somalia.

The SEALs entered the compound and took the positions they had selected based on the intelligence collected in advance of the raid.

Then a lone al Shabaab fighter walked out into plain view, smoked a cigarette, and went back inside, one source familiar with the details of the raid said. The fighter played it cool, and gave no indication that he had spotted the SEALs. But he came back out shooting, firing rounds from an AK-47 assault rifle.

Soon the American commandos were under siege from the warlord’s well-armed fighters. Gunfire swept toward their positions and grenades began to rain down, multiple military sources said.

Farah Abdi Warsameh / ASSOCIATED PRESS Hundreds of newly trained Shabaab fighters perform military exercises in the Lafofe area some 18 kilometers south of Mogadishu on Thursday, Feb. 17, 2011.

Several of the SEALs could see Ikrima through the windows of the compound, but couldn’t get to him. The SEALs continued to take fire while trying to find a way to get closer to their target.

And then the children came into the pictures on their scopes.

The suspect was barricaded and heavily protected by armed men, and now children were intermingled among the fighters and in danger of dying. Then the whole town of Barawe began to erupt and more armed fighters were seen heading for Ikrima’s compound. Soon there would be fewer than two dozen Americans against hundreds of Somalis.

The SEALs opted to withdraw.

U.S. military sources said they did so in stages, making their way down the beach, asking and waiting for further orders. The team, sources said, was still considering the option of returning to fight some more.

As air support was called in, the SEALs headed back to the beach and to their boat. A command decision had been made that the prize was not worth the risk of casualties to civilians and SEALs.

The SEALs escaped from Barawe without any deaths or injuries, according to sources and officials. And the target they sought to capture is still at large.

The SEALs were members of the same unit that raided Osama bin Laden’s compound in 2011, killing the al Qaeda leader.

“After the past few years and the bin Laden raid, everyone thinks these operations are easy – they’re not,” said a senior military official familiar with the operation. “The area doesn’t have the same support network for us as Afghanistan and Iraq.”

The SEALs were “amazed” no one was hurt in the Somalia operation, said the official.

In a statement, Pentagon press secretary George Little said that U.S. military personnel had conducted a targeted operation against Abdikadir Mohamed Abdikadir, a Kenyan of Somali origin. The statement referred to him as a close associate of al Qaeda operatives involved in the 1998 bombing of the U.S. embassy in Nairobi, Kenya and the 2002 attacks in Mombasa that killed Kenyans and Israelis.

“While the operation did not result in Ikrima’s capture,” said the statement, “U.S. military personnel conducted the operation with unparalleled precision and demonstrated that the United States can put direct pressure on al Shabaab leadership at any time of our choosing.”

In a simultaneous operation 3,000 miles away, U.S. special forces whisked al Qaeda suspect Abu Anas al-Libi off the streets of the Libyan capital of Tripoli. He will be taken to the United States to stand trial for his alleged role in the 1998 bombings of the American embassies in Kenya and Tanzania, the officials said.

More from NBC News Investigations:

Follow NBC News Investigations on Twitter and Facebook