Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

ISTANBUL — Turkey's president declared he is in control of the NATO country early Saturday as loyal military and police forces fought to squash a coup attempt during a night of explosions, air battles and gunfire that left dozens dead.

A faction of the armed forces attempted to seize power using tanks and attack helicopters, some strafing the headquarters of Turkish intelligence and parliament in Ankara, others seizing a major bridge in Istanbul.

At least 194 people were killed in clashes, Gen. Umit Dundar told a press conference. He said that figure included 47 civilians, 41 police officers, two soldiers and 104 alleged coup plotters.

Turkish Prime Minister Binali Yildirim later said that 1,440 people had been wounded and 2,839 military personnel detained during what he described as a "dark stain on Turkish democracy." He also pinned blame for the coup on the "parallel terrorist organization."

The coup attempt crumbled after crowds answered President Recep Tayyip Erdogan's call to take to the streets and dozens of rebels abandoned their tanks. Government officials blamed the unrest on a Pennsylvania-based Islamist cleric.

Turkey PM declares the coup over & failed. Praises ordinary citizens for fighting tanks & troops. — Bill Neely (@BillNeelyNBC) July 16, 2016

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 a major U.S. ally while war rages on in neighboring Syria.

Erdogan, who had been on vacation on the country's southwest coast when the coup was launched, appeared to accuse the coup plotters of trying to kill him.

He added that the rebels "will pay a heavy price for their treason to Turkey," according to a transcript of his remarks provided by his office to The Associated Press. "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."

An image taken from video shows Turkey's President Recep Tayyip Erdogan addressing the nation via Facetime during the attempted coup. CNN Turk / via Reuters TV

Operations at the Incirlik joint military airbase in southern Turkey – home of the 39th Air Base Wing – were briefly halted during the coup but U.S.-led combat operations in nearby Syria and Iraq were unaffected, U.S. officials told NBC News. American forces were put on their highest threat level alert - “DEFCON DELTA” - until it was determined that the coup attempt posed no immediate threat.

A Turkish government official placed a frantic call to Washington pleading for a statement of support from Washington, the U.S. officials said. Both President Obama and Secretary of State John Kerry released statements declaring US support for the “democratically-elected government of Turkey.”

Erdogan, whose Islamist-rooted ideology lies deeply at odds with supporters of modern Turkey's secular principles, said the plotters had tried to attack him in the resort town of Marmaris.

"They bombed places I had departed right after I was gone," Reuters quoted him as saying. "They probably thought we were still there."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Gallery: Stunning Images Captured During Coup Attempt

With roots in Islamism, Erdogan's AK Party has long had a strained relationship with the military and nationalists in a state that was founded on secularist principles after World War I. The military has a history of mounting coups to defend secularism, but has not seized power directly since 1980.

Fighting continued into the early morning, with the sounds of huge blasts echoing across Istanbul and Ankara, including at least one bomb that hit the parliament complex. Television footage showed images of broken glass and other debris strewn across a lobby leading to the assembly hall.

The Greek air force confirmed that eight men were arrested on charges of illegally entering the country after arriving at a civilian airport just across the border in a Black Hawk helicopter. Police in the neighboring country told NBC News that they applied for political asylum. They were not armed and were all wearing military uniforms without insignia, Greek police spokesman Loukas Krikos said.

The chaos capped a period of political turmoil in Turkey which critics 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 is a NATO member and key partner in U.S.-led efforts to defeat ISIS. A coup against the democratically elected government could make it difficult for the United States to continue to cooperate with Turkey.

Supporters of Turkish President Recep Tayyip Erdogan cheer at the Ataturk Airport in Istanbul on Saturday. HUSEYIN ALDEMIR / Reuters

Erdogan flew into Ataturk airport early Saturday and was greeted by large crowds.

He told them: "They have pointed the people's guns against the people. The president, whom 52 percent of the people brought to power, is in charge. This government brought to power by the people is in charge. They won't succeed as long as we stand against them by risking everything."

In images broadcast on CNN-Turk, dozens of soldiers walked among tanks with their hands held up, surrendering to government forces on Istanbul's Bosporus Bridge. Discarded gear was strewn on the ground. Civilians, some holding flags, climbed onto the tanks.

Soldiers involved in the coup attempt in Turkey surrender on Istanbul's Bosphorus Bridge with their hands raised on Saturday. Gokhan Tan / Getty Images

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 backed by tanks blocked entry to Istanbul's airport for a couple of hours before being overtaken by pro-government crowds carrying Turkish flags, according to footage broadcast by the Dogan news agency.

Reuters reported early Saturday that a pro-coup faction said in an emailed statement from the Turkish military General Staff's media office address that it was determinedly still fighting. Calling itself the Peace at Home Movement, the faction also called on people to stay indoors for their own safety.

Erdogan and other officials blamed the attempted coup on followers of Fethullah Gulen, an influential cleric in self-imposed exile in the U.S. who once supported Erdogan but became a nemesis.

The pro-Gulen Alliance for Shared Values said it condemned any military intervention in domestic politics, and Gulen on Saturday denied any accusation of a role in the uprising.

Secretary of State John Kerry said he phoned the Turkish foreign minister and emphasized "absolute support for Turkey's democratically elected, civilian government and democratic institutions."

Turkey is one of the main backers of opponents of Syrian President Bashar al-Assad in that country's civil war, host to 2.7 million Syrian refugees and launchpad last year for the biggest influx of migrants to Europe since World War II.

Uniforms and weapons belonging to Turkish soldiers involved in the coup attempt who later surrendered were abandoned on Istanbul's Bosphorus Bridge on Saturday. Gokhan Tan / Getty Images

Turkey has suffered numerous bombings and shootings this year, including an attack two weeks ago by Islamists at Ataturk airport that killed more than 40 people, as well as those staged by Kurdish militants.

After serving as prime minister from 2003, Erdogan was elected president in 2014 with plans to alter the constitution to give the previously ceremonial presidency far greater executive powers.

Turkey has enjoyed an economic boom during his time in office and has dramatically expanded its influence across the region. However, opponents say his rule has become increasingly authoritarian.