Elements of the Turkish military backed by tanks staged an attempted coup against the government of President Recep Tayyip Erdogan on Saturday, sparking bloody clashes in major cities.
It was unclear who was in control of the strategic NATO country of 80 million people as the soldiers took to the streets and multiple explosions rang out overnight in the country's two biggest cities.
Erdogan and his government predicted that the move would fail and called for supporters of the ruling Justice and Development Party (AKP) to come out onto the streets.
Looking shaken, the Turkish leader appeared on television from an unknown location insisting he was still in power and vowing the putschists would pay a "very heavy price".
"I certainly believe that coup plotters will not succeed," he said, speaking on a mobile phone via FaceTime.
An AFP photographer saw troops open fire on people gathered near one of the Bosphorus bridges in Istanbul and state-run news agency Anadolu reported that the parliament in Ankara had been bombed.
The sound of fighter jets flying over Istanbul and Ankara signalled the start of the putsch late on Friday and they could still be heard in the early hours of Saturday.
World leaders called for calm, with US President Barack Obama urging support for the government which he said had been elected in democratic elections.
State broadcaster TRT said the troops behind the putsch had declared martial law and a curfew, in a statement signed by a group calling itself the "Council for Peace in the Homeland".
"The power in the country has been seized in its entirety," the statement said.
It said the coup had been launched "to ensure and restore constitutional order, democracy, human rights and freedoms and let the supremacy of the law in the country prevail, to restore order which was disrupted".
It was not yet clear whether the attempted takeover had widespread backing in the military, or rogue elements within it. No named military officer claimed responsibility for the actions.
A group of soldiers raided the Dogan Media Group, one of Turkey's largest private media organisations, the CNN-Turkey channel which it owns said.
The government received expressions of support from members of the political opposition, including the leader of the Republican People's Party (CHP) Kemal Kilicdaroglu.
A presidential source said that Erdogan, believed to have been holidaying by the Aegean when taken by surprise with the coup attempt, was about to land in Istanbul in his plane.
Turkey's once-powerful military has long considered itself the guardian of the secular state founded by Mustafa Kemal Ataturk in 1923.
It has staged three coups since 1960 and forced out an Islamic government in 1997.
Erdogan's critics have long accused him of undermining modern Turkey's secular roots - but the president was believed to have won control of the military after purging elements who opposed him.
The Turkish strongman urged people to rally in his support, prompting hundreds of supporters to gather in Turkey's three main cities of Ankara, Istanbul and Izmir, AFP correspondents said.
"I urge the Turkish people to convene at public squares and airports. I never believed in a power higher than the power of the people," he said.
There was chaos in Istanbul as angry crowds took to the streets to boo the passing tanks, while others celebrated. Fighter jets could be heard flying over the city.
"We are angry at the military because they are killing us, they are killing civilians," one protester told AFP, asking not to be named.
But other Turks were welcoming news of the coup.
"Turks are on fire," Fethi Karabas, a 27-year-old tour guide in Taksim Square, told AFP.
"We have hope now," he added. "Turkey has been in a very polarised state for almost 15 years now... This is the manifestation of all that anger." Erdogan also blamed the events on "the parallel state" and "Pennsylvania" - a reference to Pennsylvania-based cleric Fethullah Gulen, his arch-enemy who he has always accused of seeking to overthrow him.
But Gulen's Hizmet (Service) movement angrily denied the claim, saying "we condemn any military intervention in domestic politics of Turkey." Reports said that flights into Istanbul's main international airport had been halted. The Bosphorus bridges were closed in both directions and completely empty of traffic.
The coup plotters sought to reassure the international community, saying in their statement: "All our international agreements and commitments retain their validity." It added: "We hope our good relations will continue with all countries in the world." But there was a flood of concerned reactions from around the globe, with EU foreign policy chief Federica Mogherini calling for "restraint and respect for democratic institutions".
Obama has been briefed, while the Kremlin said it was "deeply concerned" by the developments.
"Everything must be done to protect human lives," said a spokesman for German Chancellor Angela Merkel.