Turkish Prime Minister Binali Yildirim says 2,839 members of military have been detained in connection with an attempted coup. (Reuters)

Thousands of military officers, soldiers and other suspects linked to a failed coup in Turkey have been arrested, authorities said Sunday, amid signs that the campaign against the alleged plotters was turning into a crackdown on President Recep Tayyip Erdogan’s opponents.

The country’s justice minister said that as many as 6,000 people had been detained by early Sunday.

Among those arrested was the commander at Incirlik Air Base, which is used by U.S. forces to launch raids against Islamic State militants in Iraq and Syria, a senior Turkish official said, speaking on the condition of anonymity. Gen. Bekir Ercan Van was detained along with 10 other soldiers on Sunday. The facility is a major NATO installation hosting U.S. forces that control a stockpile of nuclear weapons.

The U.S. consulate in the southern Turkish city of Adana said Saturday that authorities had cut power to Incirlik and blocked movement to and from the facility. Turkey also closed its airspace to military aircraft. But the Pentagon said Sunday that the country’s airspace had opened again, and that all anti-Islamic State operations had resumed.

“U.S. facilities at Incirlik are still operating on internal power sources, but we hope to restore commercial power soon. Base operations have not been affected,” the Pentagon’s press secretary, Peter Cook, said in a statement.

As many as 3,000 soldiers — including senior commanders in the Turkish armed forces — have been seized by authorities in response to the unrest, which killed at least 265 people and rattled the stability of a key Middle Eastern nation and important U.S. ally.

“What we saw appears to show serious fracturing in Turkey’s military,” said Soner Cagaptay, director of Turkish research at the Washington Institute for Near East Policy. “This is the second-largest largest military of NATO, an ally of the U.S. that borders Iran, Iraq, Syria, Russia and the Islamic State. And the last thing Washington wants is to see such an influential NATO member’s military fracture.”

The arrest of so many soldiers suggests that a significant number of Turkey’s armed forces personnel took part in the attempted overthrow. After the United States, the country operates the largest military in NATO.

Some of the most senior military figures arrested in the coup plot include Gen. Akin Ozturk, a former commander of the Turkish Air Force and military attaché to Israel who is a member of the Supreme Military Council.

Another is Gen. Adem Huduti, commander of the Second Army, which protects Turkey’s borders with Syria, Iraq, and Iran. And Rear Adm. Hakan Ustem, commander of Turkish Coast Guard, was removed from his post, a senior Turkish official said, speaking on condition of anonymity because he was not authorized to discuss the subject. It is unclear if Ustem has been arrested.

Arrest warrants have also been issued for at least 2,745 judges and prosecutors across the country, according to Turkish media reports.

Rogue officers of Turkey’s military declared martial law and attempted to overthrow the government of President Recep Tayyip Erdogan overnight, but Erdogan a few hours later said his government is in control. (Jason Aldag/The Washington Post)

Erdogan seems to have been emboldened after overcoming the biggest challenge to his 13-year rule, with thousands of supporters taking to the streets in Istanbul and other areas of the country in defiance of the rogue soldiers who hatched an elaborate plot to overthrow the government.

The Turkish leader has alarmed many here over his attempts to consolidate power over the years. Some Turks have expressed concern that Erdogan will use Friday’s incident to further marginalize all forms of challenge to his growing powers, whether peaceful or not, even as the country struggles with myriad crises, including unrest from its large minority of Kurdish citizens and spillover from the civil war in neighboring Syria.

Nearly 3 million war-weary Syrians have taken refuge in Turkey, a country of 75 million people.

A series of recent attacks linked to the Islamic State and Kurdish separatists have killed hundreds of people and badly damaged the Turkish economy.

By Saturday, authorities appeared to have neutralized the last threats from the attempted coup, but it was a greatly diminished Turkey that emerged from the chaos of the night before.

Turkish officials say that the mastermind of Friday’s failed plot is Fetullah Gulen, an estranged friend of Erdogan’s and a popular religious cleric who lives in the United States. Gulen has denied any connection to the plot.

Analysts say that Gulen has many supporters who have deeply penetrated Turkey’s police and judiciary, but that he holds minimal support in the military.

Erdogan on Sunday attended a mass funeral in Istanbul for five people killed in the unrest. Other senior officials in attendance included Abdullah Gul, a former president, and Ahmet Davutoglu, former prime minister.

During the services, held at Istanbul’s Fatih Mosque, Erdogan again fingered Gulen as a central figure in the plot.

The throngs of people in attendance had angry words about Gulen, even calling for his death.

“We want execution!” some in crowed yelled.

Erdogan, however, urged restraint.

“If they have guns and tanks, we have faith,” he told the mourners. “So let us think before taking each step. We will act with reason.”

Zeynep Karatas contributed to this report.

Read more: