Eight Germans and a Peruvian man were among the ten people killed in a suicide bombing in the heart of Istanbul's historic tourist district, which is being blamed on a Syrian member of the so-called Islamic State group. 

Turkish Prime Minister Ahmet Davutoglu said all of those killed in the attack were foreigners and he had spoken with German Chancellor Angela Merkel to express condolences.

15 other people were wounded, most of them German, he said.

Shortly after the attack, the German government warned its nationals to avoid crowds and tourist sites in Istanbul.

A Turkish official had earlier said that at least nine Germans were among 10 people killed in the bombing that occurred in the historic Sultanahmet square, close to the Blue Mosque and Hagia Sophia.

Chancellor Angela Merkel said Germany would put up a determined fight against terror.

"We feel a sense of solidarity with Turkey," Ms Merkel said, adding that those who carry out such attacks, be it in Paris, or Copenhagen or Istanbul, have the same target - "our free life and free society".

"The terrorists are the enemies of all free people, they are enemies of humanity, be it in Syria, Turkey or France or Germany," she said, stressing that Berlin would fight such terror "with determination".

Six German citizens, one Norwegian and a Peruvian woman were among the wounded, the Dogan news agency said.

Norway's foreign ministry said one Norweigan man was injured and is being treated in hospital.

Witnesses said the blast could be heard in adjacent neighbourhoods.

The White House condemned the attack and said it stood by Turkey in its fight against terrorism.

"This heinous attack occurred in Istanbul's historic heart, and struck Turks and foreign tourists alike," National Security Council spokesman Ned Price said in a statement.

He said Washington stood with Turkey and pledged "our ongoing cooperation and support in the fight against terrorism".

The US State Department also condemned the attack that killed at least ten people. 

The attack comes just over a year after a female suicide bomber blew herself up at a police station for tourists off the same square, killing one officer and wounding another.

That attack was initially claimed by a far-left group, but later turned out to have been perpetrated by a woman with suspected Islamist militant links, officials said.Kurdish, leftist and Islamist militants have all carried out attacks in Turkey in the past.

Turkey is on alert after 103 people were killed on 10 October when two suicide bombers attacked a crowd of peace activists in the capital Ankara, the bloodiest strike in the country's modern history.

That operation was blamed on IS, as were two other assaults in the country's Kurdish-dominated southeast earlier in the year.

Turkish authorities have in recent weeks detained several suspected IS members with officials saying they were planning attacks in Istanbul.

But Turkey is also waging an all-out assault on the outlawed Kurdistan Workers' Party (PKK) which has staged dozens of deadly attacks against members of the security forces in the southeast of the country.

A Kurdish splinter group, the the Freedom Falcons of Kurdistan (TAK) claimed a mortar attack on Istanbul's second international airport on 23 December which killed a female cleaner and damaged several planes

Meanwhile, the banned ultra-left Revolutionary People's Liberation Party-Front (DHKP-C) has also staged a string of usually small-scale attacks in Istanbul over the last months.

Turkey has also become a target for IS, with two bombings last year blamed on the radical Sunni Muslim group, in the town of Suruc near the Syrian border and in the capital Ankara, the latter killing more than 100 people.