World leaders expressed support for Turkey and its democratic institutions on Saturday after the government quashed an attempted military coup.

BRITAIN

British Foreign Secretary Boris Johnson said he had spoken to his Turkish counterpart, Mevlut Cavusoglu, to underline support for Turkey's "democratic elected government and institutions" in the wake of the overnight coup attempt.

The Foreign Office is advising Britons in Turkey to stay indoors, avoid public places, especially demonstrations, and remain vigilant.

British Airways says it is cancelling all flights to and from Turkey Saturday, but budget airline easyJet says it plans to runs its scheduled flights, largely to Turkish resort towns. The airline says the schedule "will be kept under continuous review."

NATO

NATO's chief says all alliance personnel and military units in Turkey are "safe and secure" following the attempted coup.

NATO Secretary-General Jens Stoltenberg said in a Twitter post that he had spoken to NATO's supreme commander, U.S. Army Gen. Curtis M. Scapparrotti, who "confirms that all NATO personnel and units in Turkey are safe and secure."

The alliance chief also tweeted that he welcomed "the strong support shown by the people and all political parties to democracy and to the democratically elected gov of Turkey."

SPAIN

Spain's acting Foreign Minister Jose Manuel Garcia Margallo condemned the attempted coup, telling Spanish national television that his government completely supports the Turkish government headed by President Recep Tayyip Erdogan.

He says "without a doubt we support respecting the constitution and democratically elected institutions, and we condemn all coups without reservation."

Garcia Margallo spoke by telephone from Mongolia, where he is attending the ASEM Asia-Europe Meeting.

ITALY

Italy's foreign minister says his Turkish counterpart has defined the coup attempt as "terroristic."

Paolo Gentiloni, in a phone conversation with Turkish Foreign Minister Mevlut Cavusoglu, expressed "satisfaction that popular mobilization and defence of the institutions prevailed" in Turkey, according to a statement from the Italian Foreign Ministry.

The statement said Cavusoglu, who was speaking from the Turkish capital, Ankara, confirmed the "failure of the attempt that he termed terroristic."

COUNCIL OF EUROPE

The Council of Europe is calling for Turkey's public institutions to resume their normal functions and is offering its help in the aftermath of the coup attempt.

Council of Europe Committee of Ministers Chair Marina Kaljurand condemned the coup attempt and expressed her support for the democratically elected authorities.

"I call for the resumption of the normal functioning of public institutions and reaffirm the Council of Europe's availability to continue to assist Turkey on the basis of the principles of democracy, human rights and the rule of law," she said in a statement.

JAPAN

Japanese Prime Minister Shinzo Abe said "democratic institutions should be respected in Turkey."

"We strongly hope that the situation will return to normal and that order and peace will be restored as soon as possible," he said in a statement.

SYRIAN OPPOSITION

The exiled Syrian opposition congratulated the Turkish people for halting the attempted military coup.

The Turkey-based Syrian National Coalition said Turkey has protected its democratic institutions "in the face of dark and desperate attempts that sought to take control of the popular will."

It says the Turkish people value democracy and "will not let a group of putschists take it away in a desperate attempt to restore military rule."

Turkey has been one of the main backers of the uprising against Syrian President Bashar Assad, and is hosting some 2.7 million Syrian refugees.

In the early hours of the attempted coup, celebratory gunfire broke out across Damascus. The government and its supporters view the rebels as terrorists and consider Turkey to be one of their chief sponsors.

HAMAS

The Islamic militant group Hamas has congratulated Turkish President Recep Tayyip Erdogan for quashing a "vicious" plot to overthrow him.

The Turkish leader has been a staunch supporter of Hamas and a fierce critic of Israel. Hamas says it remembers Turkey's "wise leadership in supporting the Palestinian people and their cause" and working to lift the blockade on Gaza, the coastal territory ruled by the group.

Hamas supporters took to the streets in several places across the Gaza Strip to celebrate the failure of the coup, raising Turkish flags and posters bearing Erdogan's image.

Turkey recently restored ties with Israel after a six-year lull following a deadly Israeli naval raid to stop an activist flotilla aiming to breach the Gaza blockade.

QATAR

The Gulf nation of Qatar, which has close ties to Erdogan's government, was quick to condemn the military coup attempt.

It called the attempted coup a "violation of the constitutional legitimacy" in Turkey and said it supports all legal measures the government takes to maintain security and stability.

The official Qatar News Agency said the ruling emir, Sheikh Tamim bin Hamad Al Thani, has spoken with Erdogan by phone to express Qatar's support.

Qatar and Turkey have grown increasingly close in recent years, and share similar stances on their support for Syrian rebel groups and the Muslim Brotherhood. The two countries agreed last year to establish a Turkish military base in Qatar.

IRAN

Iran said the attempted military coup in Turkey was "doomed to fail."

Foreign Minister Mohammad Javad Zarif was quoted by the official IRNA news agency as praising the "brave defence by the people of Turkey of their democracy and elected government."

He said the events in neighbouring Turkey prove "that coup d'etat has no place and is doomed to fail in our region."

PAKISTAN

An aide to Prime Minister Nawaz Sharif condemned the attempted coup in a statement and said Pakistan "hopes that peace and normalcy will be restored in Turkey."

Tariq Fatimi also said he had contacted Turkey's foreign minister to express solidarity with Turkey's government and democratic institutions.

Pakistan's main political parties have also praised the people of Turkey for foiling the coup.

Sharif was himself overthrown in a 1999 coup led by Gen. Pervez Musharraf, who ruled Pakistan until 2008.

AFGHANISTAN

Afghan President Ashraf Ghani expressed support for Turkey's elected government, saying in a statement that "democratic elections are the most effective means for peaceful transfer of power."

"Militaristic options will only undermine democratic institutions, stability and development in the country," the statement from Ghani's office said.

INDIA

External Affairs Minister Sushma Swaraj said India is "closely following the developments in Turkey."

"India calls upon all sides to support democracy and mandate of the ballot, and avoid bloodshed," she said on Twitter.

SUDAN

Sudanese President Omar Bashir condemned the attempted coup in Turkey and expressed support for the government.

Bashir, who himself came to power in a 1989 military coup, said in a statement that the "Sudanese people and government stand alongside President Recep Tayyip Erdogan, his government and the people of Turkey."

Sudan's Foreign Ministry congratulated "Turkey, its president, government and people for the decisive victory of the national will."

HUNGARY

Foreign Minister Peter Szijjarto said Hungary condemns the attempted coup "in the firmest way."

"Based on the number of deaths and the way it was carried out, this attempted coup can be also called an act of terror," he said.

He added that Hungary is "in solidarity with the Turkish government chosen in democratic elections and with the Turkish president."

AZERBAIJAN

The president of Turkey's neighbour Azerbaijan condemned the attempted coup.

President Ilham Aliev was concerned about developments in Turkey and "welcomed measures taken to prevent the attempt at a coup and to stabilize the situation," spokesman Ali Hasanov said.

Azerbaijan is a Turkic nation and its late president Geidar Aliev once described their relations as "one nation, two states" -- a phrase later echoed by Turkish President Recep Tayyip Erdogan.

TURKMENISTAN

Turkmenistan says the coup attempt has caused "serious anxiety."

The Foreign Ministry said President Gurbanguly Berdymukhamedov "expressed support for the Turkish people and government and also firm confidence in stabilizing the situation in Turkey."

Turkmenistan is ethnically Turkic but does not share a border with Turkey.