An attempt by Turkey's military to oust President Recep Tayyip Erdogan failed, as hundreds of people perished in violent clashes that ended after forces loyal to the embattled leader reasserted control over the country.
The crisis began late Friday, with Erdogan traveling abroad. Rebel military forces seized on the opportunity, taking control of key positions but encountering stiff resistance by elements loyal to Erdogan's elected government.
At least 194 people were killed in clashes, Turkey's acting military chief Umit Dundartold a press conference on Saturday. He said that figure included 47 civilians, 41 police officers, two soldiers and 104 alleged coup plotters. An additional 1,154 people were injured.
Dundar, who was appointed after the military could not be accounted for in the chaos of an attempted coup by rebels in the armed forces, was cited by Reuters as saying that anyone who betrayed the country would not go unpunished.
Turkey's Prime Minister Yinali Bildirim said Friday night had been a "black stain" for Turkish democracy and called on citizens to town and city squares with Turkish flags on Saturday night. The coup had been conducted by a "parallel structure" within the army, he said, according to Reuters. They were now in the hands of Turkish justice, he added, claiming that 2,839 members of the army had been detained.
The coup attempt crumbled after crowds answered Erdogan's call to take to the streets and dozens of rebels abandoned their tanks.
Erdogan accused the coup plotters of trying to kill him and launched a purge of the armed forces, which last used force to stage a successful coup more than 30 years ago.
"They will pay a heavy price for this," Reuters cited Erdogan as saying. "This uprising is a gift from God to us because this will be a reason to cleanse our army."
Erdogan, who had been holidaying on the southwest coast when the coup was launched, flew into Istanbul before dawn on Saturday and was shown on television outside Ataturk Airport.
Addressing a crowd of thousands of flag-waving supporters at the airport later, Erdogan said the government remained at the helm, although disturbances continued in Ankara.
Erdogan addressed the nation via a video calling service, appearing on the smart phone of a CNN Turk reporter who held it up to a studio camera so viewers to the network could see him.
He said the "parallel structure" was behind the coup attempt -- his shorthand for followers of Fethullah Gulen, a Muslim cleric whom he has repeatedly accused of trying to foment an uprising in the military, media and judiciary.
Gulen, who lives in self-imposed exile in the United States, once supported Erdogan but became a nemesis. The pro-Gulen Alliance for Shared Values said it condemned any military intervention in domestic politics, according to Reuters.
Gunfire rang out, troops stormed government buildings and jets roared over the Turkish capital of Ankara on Friday night as Yildirim said a group within Turkey's military was attempting to overthrow the government.
A national curfew was announced, and other security forces had been called in to "do what is necessary," Yildirim said. The Turkish government insisted that it remained in control.
"Some people illegally undertook an illegal action outside of the chain of command," Yildirim said in comments broadcast by private channel NTV and reported by Reuters. "The government elected by the people remains in charge. This government will only go when the people say so."
President Recep Tayyip Erdogan called the events "an attempt at an uprising by a minority within our armed forces."
A correspondent for Turkish state broadcaster TRT told Reuters that soldiers had entered TRT buildings in Ankara. An announcer on TRT soon thereafter read a statement, on military orders, saying that democratic and secular rule of law had been eroded by the current government. A new constitution would be prepared as soon as possible, the announcer said, but for now, martial law is in effect.
A military helicopter opened fire over the Turkish capital Ankara, a Reuters witness said, as witnesses heard an explosion in the capital. CNN-Turk said that the explosion occurred at a state-run television building, according to The Associated Press.
Protesting crowds were fired upon, according to the AP and AFP, but it was unclear if coup supporters or pro-government forces fired the shots.
A separate statement issued by the military said that all existing foreign relations would continue and that rule of law would be a priority. That statement was not authorized by military command, a Turkish presidential source said.
Turkey's military, one of the largest in NATO, has traditionally served as a secular and pro-democratic force in Turkish politics since the reign of Mustafa Kemal Ataturk, the leader who took Turkey on a secular path in the period following the First World War.
Erdogan has had a tense relationship with U.S. President Barack Obama and other Western leaders, but the U.S. and Turkish militaries have a close, long-running partnership.
Turkey's armed forces have been engaged in simultaneous, low-level fighting against both ISIS militants on the border with Syria and with restive Kurdish elements in Turkey and Syria.
The State Department advised people to shelter in place and not try to go to the U.S. Embassy or Consulates.
A spokesman for Uber said that the company messaged its drivers and set up an in-app display for riders earlier in the evening, encouraging them to think of their own safety before travelling.
Many social media platforms were blocked in Turkey during Friday's events, according to internet monitoring groups. Twitter also said that it suspects "there is an intentional slowing of our traffic" in the country.
The dollar jumped as much as 5 percent against the Turkish lira on those reports.
Erdogan, originally came to power as prime minister in 2002 and became the country's first directly elected president in 2014. He has increasingly centralized most governmental power in that office since then, though the presidency was largely a ceremonial office up until he took the role.
Erdogan has severely curtailed freedom of speech and expression and has brought an increasingly religious bent to the Turkish government. Most of his political support is concentrated in rural, conservative, Muslim areas of the country.
The U.S. Air Force operates a base at Incirlik, Turkey, near the Syrian border. The base is home to more than 2,000 American military personnel, and the Air Force has elevated the base to its highest alert level.
The Pentagon also said that the events in Ankara have no impact on the air base and that counter-ISIL air operations from Incirlik will continue, according to Reuters. The Pentagon also said it is taking steps to ensure the safety and security of service members.
That force has grown in size in recent years as the United States has used the base to stage air strikes against ISIS fighters throughout Syria and Iraq.
Bulgaria bolstered its patrols on the Bulgarian-Turkish border and appealed to Bulgarians to restrain from travelling to the country's southern neighbour, the government press office said in a statement.
Iran said on Friday it was deeply concerned about the crisis in neighbouring Turkey after reports of an attempted military coup there.
"Stability, democracy and safety of Turkish people are paramount. Unity and prudence are imperative," Foreign Minister Mohammad Javad Zarif said on his Twitter account.
Dogan News Agency footage showed cars and buses being diverted in Istanbul. CNN Turkey showed two military vehicles and a group of soldiers lined up at the entrance of one of the bridges in Turkey's biggest city.
A Turkish official who did not want to be named said soldiers had been deployed in other cities in Turkey, but did not specify which ones. Dogan News Agency reported the national police directorate summoned all police to duty in Ankara.
This story is developing. Please check back for further updates.
Click here for the latest on the markets.
—The Associated Press, Reuters, NBC News' Kyle Griffin and CNBC's Katie Little contributed to this report.