They made the "prudent decision" to withdraw, and couldn't confirm whether they killed their target, the official said.
Abdiaziz Abu Musab, an Al-Shabaab spokesman, said at least one Al-Shabaab fighter was killed in the gunfight. But no U.S. personnel were injured or killed, a U.S. official said.
In recent months, Al-Shabaab's haven in south-central Somalia has been been increasingly squeezed as Kenyan forces fight the group from the south and African Union forces come down from Mogadishu.
At the same time, Al-Shabaab has become even more closely aligned with al Qaeda. The two groups effectively merged last year, said CNN National Security Analyst Peter Bergen.
"This is a group that has adopted al Qaeda's ideology wholesale," Bergen said. "The reason they attacked the mall was not only because it was Kenyan, but also because it attracted a fair number of Western businessmen and others living in Nairobi."