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."

@TravelGov: Martial law and a curfew have been imposed in Turkey.

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.

@AFP: #BREAKING Turkey military opens fire on crowds in Istanbul, casualties: AFP photographer

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.