WASHINGTON — An American Special Operations forces soldier was killed and four others were wounded on Friday in an attack in southwestern Somalia against fighters for the Islamic extremist group the Shabab, three Defense Department officials said. The casualties were the first to have been publicized in Africa since an ambush in Niger in October.

The American forces were alongside Somali troops at a small outpost near the town of Jamaame when they came under small arms and mortar fire, Defense Department officials said on Friday.

The American team was backed up by armed surveillance aircraft overhead, but it could not determine the location of the mortar fire in what one official called “a very quick engagement” by the militants. The Shabab, an affiliate of Al Qaeda, claimed responsibility for the attack; it has been fighting American forces in East Africa for more than a decade.

In a post picked up by the SITE Intelligence Group, which monitors online extremist message boards, the Shabab said that its fighters had struck a joint American-Somali base on the outskirts of Kismayo, mounting what it called a “fierce attack.”