The US embassy in Kenya on Saturday warned of the threat of an imminent attack on Mombasa and urged nationals to shun the country's second city.

"This is to alert all US citizens in Kenya, or planning to travel to Kenya in the near future, that the US Embassy in Nairobi has received information of an imminent threat of a terrorist attack in Mombasa, Kenya," a statement said.

"All US government travel to Mombasa is suspended until July 1, 2012."

The warning came as Kenyan police said they had detained two Iranian nationals over suspected links to a terror network planning bombings in Nairobi and Mombasa.

"We are holding these two suspects, and they are being interrogated to establish their involvement in terrorism activities," said Aggrey Adoli, police chief for Coast province.

"They have been helpful, it is through them that we were able to find some chemicals which we believe is used to make explosives," he told AFP.

One was arrested in Nairobi and the other in Mombasa.

Kenya, which invaded southern Somalia last October to help oust Al-Qaeda linked Shebab insurgents, has seen a wave of attacks blamed on the Shebab or their supporters recently.

In 1998 a series of truck bomb explosions in Nairobi and Dar-es-Salaam in Tanzania killed hundreds of people. The date marked the eighth anniversary of the arrival of US troops in Saudi Arabia.