Updated

Somali Prime Minister Abdi Farah Shirdon vowed Tuesday that his government would "finish" the Shebab militants behind Nairobi's deadly four-day mall siege.

Promising that the killers would be brought to justice, Farah Shirdon also insisted that his government would not bow to their demands for Kenyan troops to be withdrawn from Somalia and said the two countries would continue cooperating in the fight against terror groups.

Al-Qaeda-linked Shebab fighters stormed the upmarket Westgate mall on Saturday, spraying shoppers with automatic weapons fire and tossing grenades, before engaging in fierce gun battles with Kenyan security forces.

The attack, one of the worst in Kenya's history, finally ended on Tuesday, leaving at least 61 civilians and six members of the security forces dead.

The Islamists said the attack was in retaliation for the presence of Kenyan troops in their country.

Kenya invaded southern Somalia to attack Shebab bases two years ago, joining forces with a Somali militia warlord and wresting the key port of Kismayo from the extremists.

The troops later joined the 17,700-strong African Union force (AMISOM) deployed in Somalia.

Shebab spokesman Ali Mohamud Rage on Tuesday warned of further attacks if Kenyan troops did not pull out of Somalia immediately.

But Farah Shirdon insisted that Somalia had no problem with presence of the Kenyan troops on its soil, saying the two countries shared common security concerns.

"We have no problem with our Kenyan brothers," the Somali premier told France 24 television.

"They are in Somalia at request of Somalia, they are part of AMISOM and we are cooperating in the fight against Al Shebab.

"In the name of government we have invited Kenya and we are cooperating against terror. We have common enemies and we will continue cooperating as long as there is terror in our land."

Farah Shirdon said he was confident the Shebab would be eliminated as a threat, with the help of the international community.

"Al Shebab is not only a problem for Somalia, they are a problem for the region, and to the international community," he said. "We are suffering on the same blood.

"But I am happy that we we will contain them and they will not be a problem in the near future, inshallah.

"We have over 17,000 AMISOM troops in Somalia and ... with the help of our own people and the international community, I am confident that we will finish Shebab."

Farah Shirdon said earlier during a UN human rights meeting in Geneva that those responsible for the massacre "must be held accountable," and that a military solution would not address the problems that enabled Shebab to attract support from disaffected young Somalis.

"Promotion of the rule of law, greater regional cooperation, economic stability and provision of public services are all key factors that complement the military efforts," he said.

"It is therefore essential to create educational and economic opportunity for youth."