President Uhuru Kenyatta said on Wednesday Kenya was committed to remaining part of an African Union-led peacekeeping force in Somalia, after al Shabaab militants said they killed more than 100 soldiers in an attack on an army base.
The Islamist militants attacked the remote base close to the border with Kenya on Jan. 15, killing soldiers and seizing military equipment. Kenya has declined to say how many died.
"This is not the time to waiver or to listen to the voices of defeat and despair," Kenyatta told a televised memorial service for the dead soldiers, attended by Somali President Hassan Sheikh Mohamoud and Nigeria'sMuhammadu Buhari.
The main opposition party in Kenya has called for the withdrawal of troops from Somalia but Kenyatta said Kenya was committed to bringing stability to the neighbouring country.
African Union troops, now numbering about 22,000 from several African nations, have spent nearly a decade battling al Shabaab in Somalia, a country mired in conflict since civil war broke out in 1991.
Al Shabaab, which seeks to overthrow the Western-backed government in Mogadishu, often says its attacks against Kenyan targets are retaliation for its participation in the force, known as AMISOM, which also includes Uganda and Burundi.
The al Qaeda-aligned militants have been driven out of major strongholds in Somalia by AMISOM and Somali army offensives, but the group still controls some rural areas and often launches guerrilla-style assaults and bomb attacks.
Mohamoud repeatedly thanked the Kenyan people for their assistance in his government's fight against al Shabaab, which he called "barbaric devils."
"I want to assure you, we will defeat them," he said.
Buhari, whose country also faces an Islamist insurgency from the group Boko Haram, expressed solidarity with Kenya, saying Nigerians "share your pain and grief."
Newspaper pictures of coffins draped with Kenyan flags bringing back dead soldiers from the attack have increased pressure on Kenyatta and his military chiefs.
Al Shabaab has published photos which purport to show the bodies of dozens of Kenyan soldiers. Most appear to have been shot in the head.