There seems to be trouble in Turkey as the elected government and the military fight to be in charge of the country.
The military said on Friday it had seized power, but the prime minister said the attempted coup would be put down.
If successful, the overthrow of President Tayyip Erdogan, who has ruled Turkey since 2003, would be one of the biggest shifts in power in the Middle East in years, transforming one of the most important U.S. allies in the region.
But according to Prime Minister Binali Yildirim, the elected government remained in office. There was no immediate word from Erdogan. A source in his office said he was safe.
Airports were shut, access to Internet social media sites was cut off, and troops sealed off the two bridges over the Bosphorus in Istanbul, one of which was still lit up red, white and blue in solidarity with victims of the Bastille Day truck attack in France a day earlier.
TRT state television announced a countrywide curfew. An announcer read a statement on the orders of the military that accused the government of eroding the democratic and secular rule of law. The country would be run by a "peace council" that would ensure the safety of the population, the statement said.
U.S. Secretary of State John Kerry and Russian Foreign Minister Sergei Lavrov, speaking jointly after talks in Moscow, both said they hoped bloodshed would be avoided.
Turkey, a NATO member with the second biggest military in the Western alliance, is one of the most important allies of the United States in the fight against Islamic State.
It is a principal backer of opponents of Syrian President Bashar al-Assad in that country's civil war, and host to 2 million Syrian refugees.
The country has been at war with Kurdish separatists, and has suffered numerous bombing and shooting attacks this year, including an attack two weeks ago by Islamists at Istanbul's main airport that killed more than 40 people.
A senior EU source monitoring the situation said: "It looks like a relatively well orchestrated coup by a significant body of the military, not just a few colonels. They've got control of the airports and are expecting control over the TV station imminently. They control several strategic points in Istanbul.
"Given the scale of the operation, it is difficult to imagine they will stop short of prevailing. It's not just a few colonels," the source repeated.
One European diplomat was diningÂ with the Turkish ambassador to a European capitalÂ when guests were interrupted by the pinging of urgent news on their mobile phones.
"This is clearly not some tinpot little coup. The Turkish ambassador was clearly shocked and is taking it very seriously," the diplomat told Reuters as the dinner party broke up. "However it looks in the morning, this will have massive implications for Turkey. This has not come out ofÂ nowhere."
In an statement sent by email and reported on TV channels, the military said it had taken power to protect the democratic order and to maintain human rights. All of Turkey's existing foreign relations would be maintained and the rule of law would remain the priority, it said.
The state-run Anadolu news agency said the chief of Turkey's military staff was among people taken "hostage" in the capital Ankara. CNN Turk also reported that hostages were being held at the military headquarters.
After serving as prime minister from 2003, Erdogan was elected president in 2014 with plans to alter the constitution to give the previously ceremonial presidency far greater executive powers.
His AK Party, with roots in Islamism, has long had a strained relationship with the military and nationalists in a state that was founded on secularist principles after World War One. The military has a history of mounting coups to defend secular principles, but has not seized power directly since 1980.
Yildirim said a group within Turkey's military had attempted to overthrow the government and security forces have been called in to "do what is necessary".
"Some people illegally undertook an illegal action outside of the chain of command," Yildirim said in comments broadcast by private channel NTV.
"The government elected by the people remains in charge. This government will only go when the people say so."
Those behind the attempted coup would pay the highest price, he added.