Military factions in Turkey tried to seize control of the country Friday night, setting off a furious scramble for power and plunging a crucial NATO member and American ally into chaos in what was already one of the world’s most unstable regions.
Early on Saturday morning, however, President Recep Tayyip Erdogan, whose whereabouts was unclear through a long night of turmoil, flew to Istanbul Ataturk Airport, a strong signal that the coup was failing.
“A minority within the armed forces has unfortunately been unable to stomach Turkey’s unity,” Mr. Erdogan said at the airport, after the private NTV network showed him greeting supporters. Blaming political enemies, Mr. Erdogan said “what is being perpetrated is a rebellion and a treason. They will pay a heavy price for their treason to Turkey.”
There were indications that coup leaders, at a minimum, did not have a tight grip on many parts of the country. Supporters of Mr. Erdogan took to the streets of Istanbul to oppose the coup plotters, and there were scattered reports some of its leaders had been arrested.
Martial law was declared in the country, which has been convulsed by military takeovers at least three times in the past half-century. President Erdogan, an Islamist who has dominated politics for more than a decade and sought to exert greater control over the armed forces, was forced to use his iPhone’s FaceTime app from an undisclosed location to broadcast messages beseeching the public to resist the coup attempt.
“There is no power higher than the power of the people,” he said in a night of wild confusion and contradictory accounts of who was in control. “Let them do what they will at public squares and airports.”
After Mr. Erdogan spoke, many of his followers obeyed his orders to go into the streets, and mosque loudspeakers exhorted his supporters to go out and protest the coup attempt.
The state-run Anadolu News Agency said 17 police officers had been killed in a military helicopter attack by coup plotters on a police special forces headquarters outside Ankara. There were also reports that fighter jets had shot down a military helicopter used by coup plotters.
CNN Turk reported that 12 civilians were killed in an explosion at the Parliament building.
The United States Embassy said in a statement that “shots have been heard in Ankara” and urged Americans to take shelter. Social media outlets worked intermittently or were blocked.
The events began unfolding around 10 p.m. Friday as the military moved to stop traffic over two of Istanbul’s bridges, which cross the Bosporus and connect the European and Asian sides of the city.
There were reports of gunfire in Istanbul’s central Taksim Square, where pro-Erdogan supporters had gathered, but there were no reports of injuries, and it appeared that security forces were acting with restraint. On the Bosporus Bridge, which was closed earlier in the evening by the military, there were reports of gunfire as protesters approached, and according to NTV, a television news channel, three people were injured.
Some military figures spoke out against a coup, including the commander of the First Army, Gen. Umit Guler, who issued a statement, carried by a pro-government news channel, saying, “The armed forces do not support this movement comprised of a small group within our ranks.”
Leaders of opposition political parties, who have otherwise worked against Mr. Erdogan’s government, also spoke out against a seizure of government by the military.
“This country has suffered a lot from coups,” Kemal Kilicdaroglu, the leader of the main secular opposition party, the Republican People’s Party, known by its Turkish initials C.H.P., said in a written statement, according to Hurriyet Daily News. “It should be known that the C.H.P. fully depends on the free will of the people as indispensable of our parliamentary democracy.”
By 2 a.m., a large group of protesters had gathered at Ataturk Airport, and the military had begun withdrawing, according to CNN Turk.
In the back streets of Istanbul’s European districts, bars and restaurants were showing footage on television of scenes at the bridge, while partygoers were glued to their mobile phones trying to learn what was happening.
“Some people illegally undertook an illegal action outside of the chain of command,” Prime Minister Binali Yildirim said in comments broadcast on NTV, a private television channel. “The government elected by the people remains in charge. This government will only go when the people say so.”
Shortly after Mr. Yildirim spoke, factions of the Turkish military issued a statement, according to the news agency DHA, claiming it had taken control of the country.
“Turkish armed forces seized the rule of the country completely with the aim of reinstalling the constitutional order, democracy, human rights and freedoms, to make rule of law pervade again, to re-establish the ruined public order,” the statement quoted by DHA said. “All the international agreements and promises are valid. We hope our good relations with all global countries goes on.”
The abrupt turn in Turkey came as Mr. Erdogan has been battling a wave of deadly extremism by the Islamic State militant group, struggling to accommodate hundreds of thousands of refugees from the war in neighboring Syria and fighting a resurgent Kurdish rebellion in the Turkish southeast.
Senior Pentagon officials in Washington said they were still trying to determine what was occurring in Turkey. They said the United States had not adjusted its military posture in the region.
The Defense Department has roughly 2,200 uniformed military personnel and civilians in Turkey. About 1,500 of them are based at Incirlik, an air base in southern Turkey near Syria. The United States has used the base to launch airstrikes against the Islamic State. Since March, Incirlik has been on an “elevated force protection level” amid concerns that militants were targeting it. Defense Secretary Ashton B. Carter in May ordered all family members of military personnel based at Incirlik to leave the country.
Mr. Erdogan blamed followers of Fethullah Gulen, a Muslim cleric who lives in exile in Pennsylvania and who once was an ally before the two had a bitter falling-out in 2013 over a corruption inquiry that targeted Mr. Erdogan and his inner circle, for the coup attempt. Over many years, followers of Mr. Gulen built up a presence in Turkey’s police and judiciary, and Mr. Erdogan blamed them for the corruption probe.
Mr. Erdogan and his allies then purged the judiciary and the police of those linked to Mr. Gulen, going so far as to call him the leader of a terrorist organization and seeking, unsuccessfully, to have him extradited from the United States. An organization associated with Mr. Gulen in the United States, the Alliance for Shared Values, denied any responsibility for the coup attempt.
Speaking to local television, Mr. Yildirim said: “Illegal acts of some people from among the military are the issue here. My citizens and my nation should know that any act that would harm democracy would not be allowed.”
He continued, “The government that the citizens of the Turkish Republic elected, representing the will of the people, is in charge and the removal of it happens only by the decision of the people. Those who did this attempt, who took part in this insanity, in this unlawful act, will pay the heaviest price. I want my citizens to know that we will not be deterred by those kinds of attempts.”
Since the founding of modern Turkey in 1923, the military has staged coups in 1960, 1971 and 1980, and intervened in 1997. The military had long seen itself as the guardian of the secular system, established by the country’s founder, Mustafa Kemal Ataturk. But in recent years a series of sensational trials had pushed the military back to its barracks, which analysts said had secured civilian leadership over the military.
Across Istanbul on Friday night, rumors swirled and evening plans were upended. In the Arnavutkoy neighborhood, people flooded out of bars and restaurants, hailing taxis and urging loved ones to get home to safety. “There’s a coup,” one man shouted in the street. “There’s a coup, and blood will be shed.”
Mr. Erdogan attracted a wide-ranging constituency in the early years of his tenure, including many liberals who supported his plans to reform the economy and remove the military from politics. But in recent years he has alienated many Turks with his increasingly autocratic ways, cracking down on freedom of expression, imposing a significant role for religion in public life and renewing war with Kurdish militants in the country’s southeast.
“The people tried to stand up against President Erdogan, but they couldn’t, they were crushed, so the military had no choice but to take over,” said Cem Yildiz, a taxi driver.
Mr. Yildiz said that recent terrorism in the country attributed to Islamic State militants, including a recent attack on Istanbul’s main airport that killed dozens, was “the tipping point” for him. He blamed Turkey’s policy on Syria for the terror attacks. Early in the civil war there, Turkey supported rebel groups fighting against the Syrian government. Many of the fighters who traveled through Turkey to Syria joined the Islamic State, and critics have blamed Mr. Erdogan for enabling its rise.
“He has destroyed this country and no one will stand up to him but the military,” he said. “There was no choice but this.”
Seyda Yilmaz, a teacher who was out in Istanbul on Friday when the news broke, said, “The country is in chaos, and Erdogan needs to be put in his place, but I’m afraid. I’m very afraid because in the past a lot of innocent blood was shed in these coups. I’m anxious. I don’t know what to say at this point. We are all in shock. No one thought that the military would stand up against Erdogan.”