Updated

A group linked to Al Qaeda tried to assassinate the Somali prime minister in a homicide bomb attack in front of the premier's house that killed and injured an unknown number of people, the deputy defense minister said.

It is at least the third attempt on Prime Minister Ali Mohamed Gedi's life since he returned to Somalia in May 2005.

It took place two days after Somali security force operations and shelling from a U.S. warship led to the defeat of a group of Islamic militants in a remote, mountainous northeastern area of Somalia, during which at least eight foreign fighters were reported killed.

"It was a suicide attack. They are terrorists linked to Al Qaeda. They planned to kill the prime minister. He escaped their assassination attempt. He is alive. And now he is in a safe place," Deputy Defense Minister Salad Ali Jelle told The Associated Press.

• Complete coverage is available in FOXNews.com's Africa center.

Paddy Ankunda, spokesman of the African Union peacekeeping force in Mogadishu, said that a number of people were killed and others wounded. African Union troops are busy evacuating the wounded, Ankunda said.

An Associated Press reporter saw five bodies lying on the street outside the prime minister's house.

Ankunda said that within minutes of the explosion, peacekeepers sealed off the area around Gedi's house and took charge of security. The peacekeepers are based at President Abdullahi Yusuf's residence, the main international airport and Mogadishu port.

"I can confirm that the prime minister is safe and unharmed and our troops evacuated him from the explosion site to a safe location," Ankunda told The Associated Press.

Qasaye Mohamed Ali, who lives in the neighborhood, said he was standing near the prime minister's house when he saw the car force its way through a roadblock. Guards outside the premier's house opened fire and then the car rammed into a wall and exploded, he said.

Ali was waiting for a friend who was inside the premier's house when the explosion happened. He said he hid behind a wall to protect himself.

The last attempt on Prime Minister Ali Mohamed Gedi's life was on May 17, when a bomb exploded as Gedi's convoy was on its way to the capital's airport. No one was injured and no vehicles were damaged in that attempt.

No one has claimed responsibility for the attacks.

Sunday's attack undermines the government assertion that it has defeated Islamic insurgents who have vowed to launch an Iraq-style guerrilla war unless Somalia becomes an Islamic state.

When Gedi declared victory in April, the death toll was at least 1,670 people killed since March 12. About 400,000 people have fled the capital's violence since February.

The battles pitted the government and Ethiopian troops propping it up, against clan rivals and Islamic insurgents.

Officials of the semiautonomous region of Puntland said that the dead foreign fighters in Friday's fighting included some from the United States, Britain, Sweden, Pakistan and Yemen. Somali fighters were also killed in the mountainous northeastern area of Bargal, but officials did not specify how many.

U.S. Defense Secretary Robert Gates, traveling in Asia, declined to comment Sunday on the reported U.S. naval bombardment in the remote and mountainous area, saying "that's possibly an ongoing operation."

Elsewhere, in southern Somalia on Sunday, militias of rival clans clashed, killing nine people and wounding 12, clan elders said.

It was not clear why the fighting happened in Berhani village, about 40 miles from the port town of Kismayo, though one clan spokesman, Col. Hassan Mohamed Ali, said "This is not political war."

Ali and a leader from a rival clan, Suldan Abdirashid Dure said that elders are going to try to resolve the disagreement.

Earlier Sunday in the Somali capital, an Ethiopian army vehicle was hit when a device exploded near it, but the vehicle was not damaged, an eyewitness said. Ethiopian troops in other vehicles got out and opened fire indiscriminately, said Yahye Ali, who was nearby.

• Complete coverage is available in FOXNews.com's Africa center.