President Recep Tayyip Erdogan declared on Saturday he was in command of Turkey after thousands of civilians took on army units that had staged a coup, leaving 161 people dead and the country shaken.
Nearly 1,500 people, policemen included, were also injured in the coup attempt that began on Friday night. By Saturday morning, the military was beaten back by "People's Power" and 2,839 officers and soldiers were detained, Prime Minister Binali Yildirim said.
President Erdogan called the attempted military coup against his government an "act of treason" and vowed to his supporters that the coup plotters will pay for the chaos.
After landing in Istanbul's Ataturk Airport, he said in a televised speech: "This is a movement of treason and an insurgency. Let me tell you they will pay a heavy price for this treason."
In a separate televised address, Yildirim dubbed the coup backers as terrorists and said the nation had answered their attempt effectively, the Guardian reported. "Turkish law will now deal with coup plotters."
Chaos prevailed on Friday night amid reports that soldiers were trying to take control of bridges and key areas in major cities. Army helicopters began air strikes and shelled key locations in the capital Ankara.
Bombs struck near the Turkish Grand Assembly. Airborne shelling at several locations included the ruling AK Party headquarters, the presidential complex and the General Staff, Anadolu News Agency said.
A faction of the army had earlier declared that a "Peace Council" was running the country and there would be curfew and martial law. It said it launched the coup "to ensure and restore constitutional order, democracy, human rights and freedom".
Media reports said most of the dead were civilians, who poured on to the streets in response to calls from the President and confronted the troops, who opened fire. The police also sided with the people.
The President blamed Fethullah Gulen, a high-profile political figure and religious scholar based in the US, for the coup, CNN reported.
"If you have the courage, come back to your country. If you can. You will not have the means to turn this country into a mess from where you are," he thundered.
As Erdogan concluded his speech, thousands of people chanted and sang: "One nation, One flag, One motherland."
Gulen, however, denied he was behind the attempted coup.
"I condemn, in the strongest terms, the attempted military coup in Turkey," he said. "The government should be won through a process of free and fair elections, not force."
Gulen's movement promotes a version of Islam that embraces science, education and interfaith dialogue, earning him millions of followers but also the suspicion of many in Turkey's establishment.
General Hulusi Akar, head of the armed forces, was taken hostage by the coup plotters but later freed. The Prime Minister earlier said Umit Dündar would be the new acting chief of military staff.
During the coup attempt, Istanbul's Ataturk airport - where more than 40 people were killed in suicide attacks on June 28 - was seized by the rebels. But officers loyal to the government took it back.
Broadcaster CNN-Turk was back on air, having been closed down on Friday night when soldiers entered the building and ordered journalists to leave.
State broadcaster TRT was also taken off air by coup backers.
Later, the surrender of one unit of 60 soldiers on one of Istanbul's bridges was shown live on TV on Saturday morning. This happened after one of the helicopters being flown by rebels was shot down in Ankara.