ISTANBUL ― The Turkish military declared late Friday that it had taken over the country, but government leaders insisted that the coup would not succeed.

Tanks rolled through the streets and the sound of gunfire and explosions rang out in ​Istanbul and Ankara, sparking fear and confusion about who was in control. Later, crowds of people poured into the streets in protest.

Turkish President Recep Tayyip Erdogan landed at Istanbul’s Ataturk airport on Saturday morning and was greeted by crowds of supporters, according to images broadcast on Turkish television.

Murad Sezer/Reuters Erdogan supporters are dispersed with shots in the air by the military at Istanbul's Taksim square on Saturday morning.

The coup was announced Friday in a military statement read on TV, in which armed forces expressed concerns about rising autocratic rule and increased terrorism. The statement said martial law and a curfew would be imposed in the country.

But Erdogan, speaking to CNN Turk using FaceTime late Friday, appealed to people to resist the coup.

“I urge the Turkish people to convene at public squares and airports,” he said to CNN, according to a translation of the statement from a presidential source. “There is no power higher than the power of the people.”

Several senior military figures also spoke out against the coup and predicted it would fail, adding to public confusion about the extent of the support within the military for the takeover.

Burak Kara/Getty Images President Recep Tayyip Erdogan speaks on CNN Turk via FaceTime.

Turkish police under Erdogan have routinely cracked down on protests ― most recently a peaceful gay pride demonstration in Istanbul ― using water cannons, batons and tear gas.

Nonetheless, in the wake of Erdogan’s appeal, crowds of people flooded the city of Istanbul and blocked the streets with their cars, HuffPost Arabi reported. Mosques broadcast appeals calling on people to protest the coup.

Images on social ​media showed people congregating in public squares in Istanbul and Ankara, some clambering on tanks, others waving Turkish flags. ​

Micha Hughes, a 26-year-old University of North Carolina student who is studying in Istanbul, told The WorldPost that her street was full of demonstrators who tried to block the passage of military vehicles and tanks deployed to the neighborhood.

“Protesters were on top of all of them waving flags and blocking their movement. Slowly the soldiers emerged and the protesters were clapping and allowing them safe passage out, hugging them as the soldiers waved some flags,” Hughes said.

Long lines of people chanting slogans and vehicles honking horns proceeded down a highway in Istanbul, according to a video from HuffPost Arabi.

Emrah Gurel/Associated Press Supporters of President Erdogan protest in front of soldiers in Istanbul's Taksim square early Saturday morning.

Earlier on Friday, Turkish Prime Minister Binali Yildirim had announced that an attempted military uprising was ongoing during a broadcast on NTV television. Turkey would never allow any “initiative that would interrupt democracy,” he vowed.

“Some people illegally undertook an illegal action outside of the chain of command,” Yildirim said. “The government elected by the people remains in charge. This government will only go when the people say so.”

Military jets and helicopters buzzed over the cities of Istanbul and Ankara, sending car alarms wailing, as forces closed Istanbul’s two main bridges across the Bosphorus strait.

Bulent Kilic/AFP/Getty Images Turkish security officers detain people on the side of the road as they shut down the Bosphorus Bridge in Istanbul.

Witnesses reported the sound of shots and explosions in the capital, and images and footage shared on social media appeared to show flashes of gunfire in Ankara’s night sky.

Nicht normal !!! A video posted by Bünyamin Can (@bunyamincan_) on Jul 15, 2016 at 2:55pm PDT

People shared images of tanks rolling through the streets of Istanbul and Ankara. Tanks pulled into the entrance of Istanbul’s Ataturk airport ― the largest in the country ― according to Turkish television news reports.

#Kizilay #Ankara #Turkey 🇹🇷 A video posted by Nu〽aN (@numankebude) on Jul 15, 2016 at 2:58pm PDT

#Turkiye#son#deqiqe#hersey#cox#pis#insallah#olar#her#sey#allah#elemesin#nese#olsun#AMİN😞 A video posted by ©Welcome to my official page™ (@rizi._.official) on Jul 15, 2016 at 3:13pm PDT

Turkey’s state-run Anadolu Agency reported early Saturday morning that 17 police officers were killed when a helicopter attacked the police special forces headquarters on the outskirts of the capital city, Ankara. Meanwhile, a presidential source told The WorldPost that an F16 fighter jet shot down a helicopter, which he said had been hijacked by the people behind the coup.

Turkish state media said the Turkish parliament in Ankara was hit by a bomb, and the Turkish news site Odatv published photos purporting to show the debris inside the building.

The country’s interior minister, Efkan Ala, argued early Saturday that Turkish police and most of the military, including the top ranks, would counter the coup attempt, which he described as being perpetrated by “gangs.” He urged Turkish citizens to “fearlessly go out and support our security forces.”

Government officials blamed supporters of Fethullah Gulen, a popular Islamic cleric from Turkey now based in Pennsylvania, for the coup ― a charge his followers in the U.S. strongly denied. “Comments by pro-Erdogan circles about the movement are highly irresponsible,” the Alliance for Shared Values said in a statement.

“It’s possible that this is only a faction of the military,” Henri Barkey, director of the Middle East Program at the Woodrow Wilson International Center for Scholars, told The WorldPost. “The fact that they did not arrest Erdogan means they don’t have things totally under control.”

“My guess is that this is not an army working in unison. They are looking for allies. They are trying to convince other units to join them. Once they have momentum, they think other units will join them. It’s a very risky operation,” Barkey continued.

The U.S. Embassy urged American citizens to seek shelter early Friday morning. “Do not go to the U.S. Embassy or Consulates at this time,” a statement read. The U.S. State Department had a new emergency message for Americans in Turkey around 1:30 a.m. Saturday morning in that country:

New Emergency Message for US citizens in #Turkey pic.twitter.com/De1c20pmrz — Travel - State Dept (@TravelGov) July 15, 2016

An excerpt released from a phone call between President Barack Obama and U.S. Secretary of State John Kerry expressed hope that all parties in Turkey would “support the democratically-elected Government of Turkey, show restraint, and avoid any violence or bloodshed.”

Opposition parties, including the Kurdish-led People’s Democratic Party (HDP), also spoke out against the coup effort.

“HDP is under all circumstances and as a matter of principle against all kinds of coup,” the party leaders said in a statement.

“This country had suffered a lot from the coups. We do not [want] these difficulties to be repeated,” said Kemal Kılıçdaroğlu, head of the Republican People’s Party (CHP), according to Hurriyet Daily News.

Serhat Cagdas/Anadolu Agency/Getty Images People in Sivas, Turkey, turned out to protest the coup attempt early Saturday.

Access to Twitter and Facebook appeared to have been slowed and blocked, even with a virtual private network, in some parts of the country. The Turkish government frequently throttles the internet after major events like terrorist attacks.

An employee of Turkish state-owned media outlet TRT World in Istanbul told The WorldPost that their office was forcibly cleared by armed men on Friday and that the staff’s phones were taken.

Lucas Thorpe, an assistant professor of philosophy at Bogazici University in Istanbul, tweeted just after midnight Saturday morning that at least 50 people were lined up at an ATM in hopes of withdrawing money following the coup announcement.

Ahmet zgi/Anadolu Agency/Getty Images A jet flies low over Ankara.

Turkey joined NATO in 1952 and had a string of military coups in the following decades, the last of which took place in 1980. Erdogan has ruled Turkey since 2003, first as prime minister before assuming the presidency in 2014.

A Turkish presidential source on Friday called the latest uprising an “attack against Turkish democracy.”

“We urge the world to stand in solidarity with the Turkish people,” the source said. “Those who perpetrated this attack against Turkish democracy will be swiftly brought to justice.”

It is still too early to tell if this coup will be successful, but so far it differs from past coups in Turkey in that it is not yet clear whether or not the top military brass is behind the effort.

“If you look at Turkey’s history of military coups, right after the coup you usually hear top generals on TV explaining to the public why a coup is necessary. That has not happened yet,” Gönül Tol, director of the Middle East Institute’s Center for Turkish Studies, told The WorldPost.

If the coup attempt fails, Tol predicted that Erdogan will use the episode to further consolidate his own power and push for a full presidential system of governance ― an effort that was already underway when Erdogan forced Ahmet Davutoglu out as prime minister earlier this year.

“He will play off of fears, warn of the dark years of the 1970s and 1980s, and use the coup to push forward his own agenda,” Tol said.

Listen to President Erdogan’s statement (in Turkish) below:

This is a developing story. Please check back for updates.