(CNN) The US military conducted a "self defense" airstrike against al Shabaab fighters in Somalia early Thursday morning after a joint Somali-US force came under direct attack by militants.

US Africa Command, which oversees US troops in the region, announced in a statement Thursday that the US had conducted three "precision" airstrikes against al Shabaab militants in Somalia, killing seven fighters.

The drone strikes took place in Jilib, Somalia, about 200 miles southwest of Mogadishu, Africa Command said in its statement.

A US defense official told CNN that pro-government Somali troops, accompanied by US military advisers, came under direct attack while approaching the objective of a planned counterterrorism raid. The joint US-Somali ground force returned fire in an attempt to neutralize the al Shabbab attackers but were unable to and the US troops called in the airstrike to defeat the threat. There were no US casualties as a result of the firefight.

"During the Somali-led counterterrorism operation, a group of armed al-Shabaab terrorists posed an imminent threat to Somali-led and US forces. In response, the US conducted a self-defense strike against the armed militant group to neutralize the threat," Samantha Reho, a spokesperson for Africa Command, told CNN.

Read More