WASHINGTON (Reuters) - The United States called on all parties in Turkey to support President Tayyip Erdogan’s government against a coup attempt as world leaders expressed concern about the upheaval in a NATO member country that bridges Europe and the Middle East.

Still frame taken from amateur video obtained by Reuters on July 16, 2016 shows a tank driving past people, in Ankara, Turkey. Amateur Video/ via REUTERS TV

President Barack Obama and Secretary of State John Kerry spoke by phone and gave their support to Erdogan after Turkey’s military said it had seized power on Friday. By early Saturday, Erdogan appeared to have regained control.

“The President and Secretary agreed that all parties in Turkey should support the democratically-elected government of Turkey, show restraint, and avoid any violence or bloodshed,” the White House said in a statement.

Erdogan has ruled Turkey since 2003 and if the coup against him was successful it would have been one of the biggest shifts in the Middle East in years.

The sharp-tongued Erdogan is often accused of authoritarian rule at home and has frequently fallen out with neighbors such as Israel, Iran, Russia and the European Union as he tried to carve out a greater role for Turkey in the Middle East.

But Turkey is a key ally for Washington which has often pointed to the country as a good example of a free-market democracy in the Muslim world, even though it has a poor record on freedom of expression.

Relations between Erdogan and the Obama administration have deteriorated in recent years as Washington complained that Ankara was not doing enough to fight Islamic State. Erdogan chafes at U.S. support for Syrian Kurdish rebels, who have close ties to Kurdish guerrillas fighting in Turkey.

The United States uses the Incirlik air base in Turkey to launch strikes against Islamic State, which holds territory in Syria and Iraq. It said those operations had not been affected by the coup attempt.

The State Department told U.S. citizens in Turkey to “shelter in place and stay indoors.”

U.S. Democratic presidential candidate Hillary Clinton said she supported Turkey’s civilian government and was following the events in Turkey “with great concern.”

NATO REAFFIRMS SUPPORT

European Council President Donald Tusk called for a swift return to Turkey’s constitutional order, saying tensions there could not be resolved by guns.

“Turkey is a key partner for the European Union. The EU fully supports the democratically elected government, the institutions of the country and the rule of law,” Tusk said at a regional summit in Mongolia.

Those sentiments were echoed by German Chancellor Angela Merkel and NATO Secretary-General Jens Stoltenberg who described Turkey as “a valued NATO ally”.

“The democratic order in Turkey must be respected. Everything needs to be done to protect human lives,” Merkel’s spokesman Steffen Seibert said on Twitter.

Ties between Turkey and Germany - vital partners in efforts to curb mass migration to Europe - have been strained since Germany passed a resolution in June branding the 1915 massacre of Armenians by Ottoman forces as genocide. Ankara recalled its ambassador and threatened unspecified retaliation.

Iran, a Shi’ite Muslim nation which has long been a regional rival to Sunni majority Turkey, said on Friday it was deeply concerned about the crisis in the neighboring country.

“Stability, democracy and safety of Turkish people are paramount. Unity and prudence are imperative,” Foreign Minister Mohammad Javad Zarif said on his Twitter account.

In Syria, hundreds of cheering government supporters took to the streets of Damascus early on Saturday and celebratory gunfire erupted after Turkey’s army said it seized power from Erdogan, one of Syrian President Bashar al-Assad’s main foes in the region.

Residents said convoys of cars circled around the Mazzeh district of the Syrian capital, with people waving flags and shouting: “God, Syria and Bashar!”. There were similar celebrations in other government-held cities.

Assad’s government has accused Erdogan of fuelling Syria’s five-year conflict by supporting Islamist insurgents battling Damascus and allowing foreign jihadis to cross the border from Turkey into Syria.

The Kremlin said it was gravely concerned about events in Turkey, and that it had instructed officials to help Russian nationals in Turkey return home at the earliest opportunity.

Kremlin spokesman Dmitry Peskov told reporters on a conference call that President Vladimir Putin was being kept constantly updated on the situation in Turkey.

Britain’s new foreign minister, Boris Johnson, said he was “very concerned” by events in Turkey, where many thousands of British and other European holiday-makers were spending summer vacations.

Pakistan condemned the attempt to undermine democracy and rule of law and China’s Foreign Ministry called on Turkey to restore order and stability as soon as possible.

The Japanese Prime Minister Shinzo Abe said Turkey’s democracy must be respected, according to the Kyodo news agency.

Turkey closed the three border crossings with Bulgaria, the Bulgarian Foreign Ministry said, reiterating its appeal to Bulgarians to avoid traveling to its southern neighbor.

Mexico, Japan, South Korea and India also urged nationals not to travel to Turkey, while countries including Malaysia, Australia and New Zealand urged citizens in Turkey to be vigilant, stay indoors and keep tabs on local media.