ANKARA, Turkey --At least 42 people are reported dead in clashes in Turkey's capital, another six people are dead and 100 injured in Istanbul.
The state-run Anadolu Agency says Prime Minister Binali Yildirim is calling all legislators for an emergency meeting Saturday.
He also told Anadolu that more than 120 people have been arrested in a coup plot.
He says: "Things are getting better every minute."
Yildirim called on people to remain in the streets to support the government against coup plotters and appealed for patience.
He says a few air force planes flown by coup plotters still remain in the air. He had earlier ordered those aircraft shot down.
The military and government are both saying the country is under their control.
Tonight Turkey's President Recep Tayyip Erdogan is back on the ground calling this spontaneous attempted coup "a gift from god."
Tanks caught citizens completely off guard as the military rolled into the streets of Istanbul, blocking the Bosphorus Bridge, cutting off Europe from Asia.
This chaos is an attempted coup. Experts say part of Turkey's secular military is rising up, trying to overthrow President Erdogan.
"I think we're seeing the result of a lot of political instability in contemporary Turkey. What surprises me about this coup attempt is I thought he had a little more control of the military than he obviously does," said Scott Alexander, an associate professor of Islamic studies.
In the country's capital of Ankara, armed military members stormed state run media stations declaring martial law.
Explosions went off in a portion of parliament.
In strange twist only a modern coup could produce - a vacationing President Erdogan appeared on CNN Turk via FaceTime from an undisclosed location, urging people to run into the streets and claim their country.
They answered in packs of millions.
"Because he's so popular with many of the Turkish people I'm not sure how successful in the long run this coup can be," said Alexander.
Turkish President Recep Tayyip Erdogan told the nation Saturday that his government was working to crush a coup attempt after a night of explosions, air battles and gunfire across the capital that left at least 17 dead and scores wounded.
Government officials said the coup appeared to have failed as Turks took to the streets overnight to confront troops attempting to take over the country. However, the sounds of huge blasts continued to ring out in the capital, Ankara, and Istanbul throughout the morning, including a bomb that hit the parliament complex.
Speaking on national television from Istanbul, Erdogan said the government was arresting coup supporters in the military and "they will pay a heavy price for their treason to Turkey," according to a transcript of his remarks provided by his office. "Those who stain the military's reputation must leave. The process has started today and it will continue just as we fight other terrorist groups."
Prime Minister Binali Yildirim, speaking to state-run Anadolu Agency, said more than 120 arrests were made.
Erdogan, who said his general secretary had been abducted by the coup plotters, flew into Istanbul's Ataturk airport early Saturday and was greeted by large crowds. Hours earlier, as the coup attempt got under way, his office had declined to say where he was, and he was forced to give an interview over FaceTime to a television station.
The chaos capped a period of political turmoil in Turkey blamed on Erdogan's increasingly authoritarian rule, which has included a government shake up, a crackdown on dissidents and opposition media and renewed conflict in the mainly Kurdish areas of the southeast.
Turkey, a NATO member, is a key partner in U.S.-led efforts to defeat the Islamic State group, and has allowed American jets to use its Incirlik air base to fly missions against the extremists in nearby Syria and Iraq. A coup against the democratically elected government could make it difficult for the United States to continue to cooperate with Turkey.
U.S. President Barack Obama urged all sides in Turkey to support the democratically elected government. NATO Secretary-General Jens Stoltenberg said he spoke to Turkish Foreign Minister Mevlut Cavusoglu and called for respect for democracy.
The coup attempt began late Friday, with a statement from the military saying it had seized control "to reinstall the constitutional order, democracy, human rights and freedoms, to ensure that the rule of law once again reigns in the country, for law and order to be reinstated."
Fighter jets buzzed overhead, gunfire erupted outside military headquarters and vehicles blocked two major bridges in Istanbul. Soldiers blocked entry to Istanbul's airport, where four tanks were stationed, according to the private Dogan news agency. Two other tanks and a military vehicle were stationed in front of the VIP terminal. Dogan said the soldiers had entered the tower and stopped all flights.
But the military did not appear unified, with top commanders taking to television to condemn the action and order troops back to their barracks.
"Those who are attempting a coup will not succeed. Our people should know that we will overcome this," Gen. Zekai Aksakalli, the commander of the military special forces, told the private NTV television by telephone.
Fighter jets under the control of loyalist forces were flying over the capital to strike at helicopters flown by coup supporters, the state-run Anadolu news agency said. Private NTV television reported that one helicopter was shot down. Gunfire and explosions rang out.
Erdogan called on Turks to take to the streets across the country, and many did, marching through the streets of Izmir and Istanbul, waving Turkish flags and gathering in the main square in Ankara. The Dogan news agency reported that soldiers fired on a group of people trying to cross the Bosporus bridge to protest the attempted coup, and that some people have been hurt. TV footage showed people running for cover as shots rang out.
Troops also fired in the air to disperse a growing crowd of government supporters at the Taksim monument in Istanbul as military helicopters flew overhead. A nearby mosque made an anti-coup announcement over its loudspeakers.
During the fighting, 17 police officers were killed in a helicopter attack on police special forces headquarters on the outskirts of Ankara, Anadolu said.
An official at Haydarpasa Numune Hospital in Istanbul said at least 150 people were admitted with wounds, but would not comment on whether there were fatalities. NTV reported six dead had been brought to that hospital. An official at Istanbul's Sisli Hamidiye Etfal Training and Research Hospital said they had also received dead and wounded. Both officials spoke on condition of anonymity because they were not allowed to comment publicly.
Parliament Speaker Ismail Kahraman said a bomb hit one corner of a public relations building inside the parliament complex, injuring some police officers.
By Saturday morning, a top Turkish official said the coup attempt appeared to have been repelled. The senior official told The Associated Press that all government officials were in charge of their offices. The official requested anonymity because of the sensitivity of the issue.
Earlier, Nuh Yilmaz, a spokesman for Turkish National Intelligence told CNN Turk the coup attempt had been quashed, adding that military chief of staff Gen. Hulusi Akar was back in control. However, Erdogan raised doubts about that during his address, saying, "I don't know what the situation is concerning our chief of military staff."
The pictures from Turkey the past few hours are jarring with warplanes diving toward urban areas of the capital Ankara.
Tanks and troopers on the streets of Istanbul. Highways clogged and bridges closed. Explosions and gunfire in the neighborhoods.
What isn't so obvious from the video is what this means and how deep into the Turkish military the coup d'état is rooted.
Orhan Ulger is president of the Turkish American cultural alliance in Chicago and is in touch with his family in Turkey.
"They heard gunshots here gunshots there, military planes are flying really low, there was a bomb over here, bomb over there," said Ulger.
Turkish state television has been seized by a faction of the military, the plug pulled on major social media and marshal law now in effect according to a group calling itself the "Turkish Peace Council."
Even the White House isn't certain who is behind the coup. Turkey's Prime Minister Binali Yildirim says security forces are trying to regain control while President Recep Tayyip Erdogan has gone on FaceTime urging his supporters to the streets in opposition to the coup.
The Turkish president is blaming the coup on Fethullah Gulen, a Turkish preacher, who now lives in rural Pennsylvania. A former ally now in self-imposed exile.
"I think it's inappropriate for me to comment except to say that we've heard the reports that others have heard. I don't have any details at this point and time. I hope there will be stability and peace and continuity within Turkey, but I have nothing to add with respect to what has transpired at this moment," said Secretary of State John Kerry.
This coup attempt is a tremendous national security complication for the U.S. Incirlik Air Base hosts American service personnel, houses U.S. tactical nuclear weapons and is the gateway to current operations against Isis.
As the crisis unfolded, there were reports that access to popular social media sites like Twitter and Facebook had been blocked within the country. Facebook declined comment, but Twitter said it suspected "intentional" interference with its service.
Incirlik Air Base
The Associated Press contributed to this report.