German President Johannes Rau has cancelled a visit to Djibouti because of a "concrete threat of an attack".
President Rau was expected to discuss the 'war on terror' in Djibouti
The president's office said German intelligence had information that militants were preparing an attack on Mr Rau in the tiny East African state.
On Wednesday he was due to visit a German frigate in Djibouti - one of several warships in the Gulf of Aden as part of a US-led anti-terror operation.
Djibouti has responded, saying there was no evidence of any attack.
The country's Communications Minister, Rifki Abdoulkader Bamakhrama, said the rumours of instability and insecurity had seriously harmed his country's international reputation.
The German president has now flown back to Berlin.
Travelling with an 80-strong entourage, including businessmen and journalists, Mr Rau spent a week in Nigeria and Tanzania.
His visit to Djibouti - the first by a German leader - was expected to offer an opportunity to discuss development and the global "war on terror" with President Ismail Omar Guelleh.
Djibouti is a small but strategically situated state at the mouth of the Red Sea.
It hosts a US military base with between 1,200 and 1,500 soldiers.
Germany has sent seven ships to help US forces monitor the Gulf of Aden.
The president apologised to German troops for cancelling the visit, saying, "I will not let my travel plans be dictated by terrorists in the future".
His visit to Tanzania this weekend almost coincided with attacks on government and diplomatic targets there.
A grenade was thrown at foreign diners in a restaurant on Zanzibar island, while home-made bombs targeted the homes of politicians and religious leaders.
No one was hurt in the attacks, which were blamed on disgruntled Islamic activists.