John Kerry has commemorated the victims of Kenya's past and present attacks and offered American support in the fight against an increasingly diffuse but perhaps more dangerous threat emanating out of Somalia.

His trip to the East African country coincides with improving US-Kenyan ties and sets the stage for President Barack Obama's visit this summer.

Kerry laid a wreath on Monday for the victims of the deadly 1998 bombing of the US embassy in Kenya and offered condolences to families and friends of the 148 people, mainly students, massacred at a Kenyan university last month.

The embassy attacks in Nairobi and the Tanzanian capital of Dar-es-Salaam killed 224 people, the work of a rising al-Qaeda just three years before the even deadlier September 11 attacks against the US homeland.

Kerry told an assembled group at the park that if the attackers intended to destroy relations between US citizens, Kenyans, and Tanzanians, they failed.

"They didn't destroy anything that was worthwhile," Kerry said.  "The only place for al-Qaeda, al-Shabab, Boko Haram and Daesh is in the past."  

Daesh is another term for ISIL, or the Islamic State in Iraq and the Levant.  US officials have been using the term more frequently in order to undercut ISIL's claims that only it represents legitimate Islamic beliefs. 

'Terrorists will fail'

Last month's tragedy at Garissa University College was different, coming from an al-Shabab network that is on the run in Somalia but expanding its activities elsewhere.

"Terrorists will always fail," Kerry said at the site of the former embassy.

"Yes, they can reduce a building to rubble. And yes, they can even deprive innocent people of their lives."

"But they do not give anyone anything of what really makes life worthwhile."

Americans and Kenyans have the power to fight back, Kerry emphasised, militarily and "through our unity and the character of our ideals."

Earlier, he addressed the embassy's current staff, which includes several employees that survived the attack 17 years ago. He praised their efforts.

Kerry's presence in Kenya, however, comes shortly after a US justice department decision not to award victims of the embassy bombings money seized from Sudanese accounts at a French bank.

The US says Sudan financed and supported the attacks in Kenya and Tanzania.

George Mimba, who headed embassy employees in Kenya at the time, said in a statement that he and others were "deeply disappointed".

Obama's planned trip

Kerry, previewing Obama's scheduled trip here in July, later met Kenyan President Uhuru Kenyatta.

US relations with Kenyatta have improved since the International Criminal Court dropped charges of crimes against humanity against him in December.

Those were linked to violence that killed hundreds of people after Kenya's contested 2007 presidential election.

Tensions remain, however.

The US believes Kenyatta should do more to improve human rights, from addressing the post-election killings last decade to stamping out continued incidents of police violence and pressure against journalists, activists and political opponents.

And on counterterrorism, where cooperation is close, both sides are not completely content with the partnership.

The Kenyans want a bigger US footprint in the region to combat al-Shabab, whose activities in Kenya include the 2013 attack on the Westgate shopping mall that killed 67 people.

Al Jazeera's Rosiland Jordan, reporting from Nairobi, said Kerry held meetings with Kenyatta, opposition leaders and the chief justice to discuss security and other issues.