An attempted Turkish military coup appeared to crumble in the early hours of Saturday after crowds answered President Tayyip Erdogan's call to take to the streets to support him.
Erdogan, who had been holidaying on the southwest coast when the coup was launched by a faction in the armed forces, flew into Istanbul before dawn on Saturday and was shown on TV appearing among a crowd of supporters outside Ataturk Airport.
The uprising was an "act of treason", and those responsible would pay a heavy price, he later told reporters at a hastily arranged news conference. Arrests of officers were under way, and it would go higher up the ranks, culminating in the cleansing of the military, he said.
Soldiers took control of the airport soon after Erdogan had landed, Reuters witnesses said. A senior official later said the soldiers were loyal to the government.
Rebel soldiers who had taken control of military aircraft were still firing from the air early on Saturday and fighter jets had been scrambled to intercept them, Prime Minister Binali Yildirim said, underscoring the chaotic situation.
Gunfire and explosions rocked both the main city Istanbul and capital Ankara in a chaotic night after soldiers took up positions in both cities and ordered state television to read out a statement declaring they had taken power.
A senior official said 42 people had been killed in the violence in Ankara alone, most of them civilians. More deaths were also reported in Istanbul.
Early on Saturday, Reuters journalists saw around 30 pro-coup soldiers surrender their weapons after being surrounded by armed police in Istanbul's central Taksim square.
They were taken away in police vans as a fighter jet repeatedly screeched overhead at low altitude, causing a boom that shook surrounding buildings and shattered windows.
A successful overthrow of Erdogan, who has ruled Turkey since 2003, would have marked one of the biggest shifts in the Middle East in years, transforming one of the most important U.S. allies while war rages on its border. A failed coup attempt could still destabilise a pivotal country.
Before returning to Istanbul, Erdogan appeared in a video call to the studio of the Turkish sister channel of CNN, where an announcer held up a mobile phone to the camera to show him. He called on Turks to take to the streets to defend his government and said the coup plotters would pay a heavy price.
LAWMAKERS IN HIDING
By the early hours of Saturday, lawmakers were still hiding in shelters inside the parliament building in Ankara, which was being fired on by tanks. Smoke rose up from nearby, Reuters witnesses said. An opposition MP told Reuters parliament was hit three times and that people had been wounded.
Momentum turned against the coup plotters as the night wore on. Crowds defied orders to stay indoors, gathering at major squares in Istanbul and Ankara, waving flags and chanting.
"We have a prime minister, we have a chief of command, we're not going to leave this country to degenerates," shouted one man, as groups of government supporters climbed onto a tank near Ataturk airport.
Erdogan and other officials blamed the attempted coup on followers of Fethullah Gulen, an influential cleric in self-imposed exile in the United States who once supported Erdogan but became a nemesis.
The pro-Gulen Alliance for Shared Values said it condemned any military intervention in domestic politics.
U.S. Secretary of State John Kerry said he phoned the Turkish foreign minister and emphasised "absolute support for Turkey's democratically elected, civilian government and democratic institutions".
The coup began with warplanes and helicopters roaring over Ankara and troops moving in to seal off the bridges over the Bosphorus Strait that links Europe and Asia in Istanbul.