Anti-American protesters in Turkey have attacked three US Navy soldiers, placing white sacks over their heads while chanting "Yankee, go home!"

Footage of Wednesday's incident in Istanbul, which has been posted online, shows about a dozen men shouting at the sailors to leave the country, near where their warship was docked on an inlet of the Bosphorus Strait in the Black Sea.

The footage shows members of the group, who were carrying a banner of the left-leaning Youth Association of Turkey, throwing red paint at the sailors, while another calls them "killers".

The sailors, who were not in uniform, managed to escape the group following a struggle, in which white sacks were briefly placed over their heads, before they were chased down the road.

"Soldiers from the occupying country think they can walk around freely in Eminonu," association spokesman Melik Dibek told the Associated Press, referring to the neighborhood where the incident occurred.

The footage shows members of the group, who were carrying a banner of the left-leaning Youth Association of Turkey, throwing red paint at the sailors, while another calls them "killers" (AP)

"It's obvious why they've anchored here — because of their ambitions in the Mediterranean and the Black Sea. American imperialism is the reason why the Middle East has turned into a chamber of fire."

The sailors safely returned to their ship, the USS Ross, a guided-missile destroyer, Captain Greg Hicks, a spokesman for the US European Command, has said.

He added that shore leave for the ship's sailors was cancelled for the rest of the day.

The US Embassy in Ankara has condemned the attack on Twitter. It said it had no doubt most Turkish people would reject such an action.

While anti-American sentiment is not widespread in Turkey, some accuse the US of meddling in regional affairs.

Pentagon spokesman Colonel Steve Warren called the attack "ugly and disturbing".

He described the attackers as street thugs who "bring great discredit upon the Turks and the Turkish reputation for hospitality."

He said the assault "appears to be a one-off incident" adding that he did not believe it would disrupt relations between the US and Turkey.

The Navy has said it was working with the Turkish National Police and embassy staff to investigate the incident.

The Dogan news agency has reported that Turkish police have detained 12 people, including one woman, in connection with the incident.