Kenya and Tanzania are marking the 10th anniversary of the US embassy bombings in Nairobi and Dar es Salaam.
Prime Minister Raila Odinga joined relatives and survivors at the site of the attack in Nairobi, which is now a memorial garden.
More than 220 people died in the first major al-Qaeda attack on US targets.
“A lawless Somalia threatens Kenya’s security,” Mr Odinga said during the commemoration ceremony.
“We need to build a new strategic engagement with popular voices in Somalia.”
He said the bombing ended country’s innocence about the brutality of terrorism.
The ceremonies come days after Kenyan police narrowly failed to arrest the suspected mastermind of the bombings, Fazul Abdullah Mohammed.
Mr Odinga said the failure to apprehend Mr Mohammed reminded Kenyans that “we have terrorists in our midst still planning awful deeds”.
“We must therefore never relax our vigilance against these extremists. Let me assure Kenyans that this government will do everything possible to prevent us from ever again being attacked,” Mr Odinga said.
My eyes were destroyed on the spot by the glass / Catherine Bwire
Sunday’s botched operation to arrest Mr Mohammed has raised questions in Kenya about whether the government is doing enough to protect its citizens from the threat of terrorism.
The police have intensified their manhunt for the fugitive in the coastal city of Mombasa, and security along the country’s borders has been tightened.
The country’s sizeable Muslim community has complained that the “war on terror” is being used to victimise Muslims.
But the prime minister denied claims that the community was being used as a scapegoat, saying Islam was a religion of peace.
At least 17 Kenyan Muslims are being held in Ethiopia on suspicion of involvement in terrorism.
The BBC’s Peter Greste in Nairobi says the solemn ceremony rekindled painful memories for those who survived the attack and the families of the victims.
It also uncovered deep bitterness and frustration among the survivors who accuse both the Kenyan and the American governments of failing to compensate them for their losses, he says.
US Ambassador Michael Ranneberger said the best way to honour victims of the bombings was to look at the achievements of the last ten years.
“I truly believe that the fact that Kenya and the United States have both moved ahead to strengthen their democracies and to expand well-being for their people is probably the best honour we could possibly pay to those victims,” he said.
At about 1030 local time on 7 August 1998, a suicide bomber threw a grenade at the guardhouse outside the US embassy in Kenya’s capital, Nairobi, and tried to ram his way through the barricades.
He then detonated the explosives packed inside the vehicle, severely damaging the embassy and bringing down a seven-story building near by, killing 218 people and wounding more than 4,000.
A simultaneous attack on the embassy in Dar es Salaam killed 11 people, and wounded 72.
The bombings were al-Qaeda’s first major strike in its conflict with the United States.