Kenya has told Somalia to "put their house in order" after members of a Somali militant group attacked and killed dozens at a Nairobi shopping centre last month.
The al-Qaeda-linked al-Shabaab group said it raided the Westgate centre in revenge for Kenya's military campaign against its fighters inside Somalia.
At least 67 people were killed in the four-day siege.
Al-Shabaab repeated its warnings to Kenya of new attacks if it did not pull troops from Somalia.
Kenyan President Uhuru Kenyatta said he would not be bullied into withdrawing his soldiers, who are part of an African peacekeeping force.
He also took aim at the Somali government, which a source close to the Kenyan presidency said had also recently called for Kenyan troops to leave before withdrawing the demand under pressure from regional leaders.
"If their desire is for Kenya to pull out of Somalia, my friends, all they need to do is what they should have done 20 years ago, which is put their house in order," Mr Kenyatta told religious leaders at a multi-faith prayer meeting.
Somalia has been angered by Kenya's perceived close relationship with a former Islamist warlord now in control of Somalia's southernmost region, which borders Kenya.
There was no reaction from the Somali government.
But al-Shabaab said in a statement that if the Kenyan government’s decision was to keep its forces in Somalia, it was an indication that it had not yet learned "any valuable lessons" from the Westgate attack.
The group promised even more insecurity, bloodshed and destruction in Kenya.
The Westgate raid was the worst attack in Kenya since al-Qaeda bombed the US embassy there in 1998, killing more than 200 people, mostly Kenyans.