The stunning sweep of Turkey's crackdown following an attempted coup last week forces questions about how far President Recep Tayyip Erdogan will go in a tense, conspiracy-fueled country. While the purges may be designed to derail any future insurrections, there are increasing concerns that Erdogan is seizing the moment to transform Turkey, steering it from its secular roots toward a more pious Muslim model and cementing personal power at the expense of democratic ideals.

The mass dismissals of Turkish teachers and closure of hundreds of schools allegedly linked to the coup plotters suggest societal shifts are afoot that could empower Erdogan's conservative Islamic base. And if answers to Turkey's course lie in presidential rhetoric, the coup plotters, and possibly a wider circle of government opponents, can expect little tolerance after an insurrection in which renegade soldiers drove tanks in city streets and fired on civilian protesters.

"The tarnished souls of the faithless were eaten up, finished and defeated before the souls of the faithful," the president said Wednesday. "Know that this will not be their first defeat, this is how it will be from now on."

Turkey, a NATO ally that describes itself as a bridge between east and west, is truly at a crossroads, embarking on a path whose ultimate consequences may not even be entirely clear to the leader who has dominated the nation of 80 million for more than a decade. For the West, the stakes are high because strategically located Turkey, spanning Asia and Europe, is considered a vital partner in efforts to contain terrorism and regulate mass migration from Syria and other conflict zones.

After the failed uprising, Turkey's elected government arrested or dismissed tens of thousands in the military, the courts, education and other sectors — "everywhere you can think of," one Turkish newspaper columnist wrote — and declared a three-month state of emergency. The country, observers say, could veer deeper into the authoritarian conduct that Erdogan has increasingly been accused of, or it could eventually honor pledges to uphold democracy after a temporary suspension of freedoms.

Erdogan is taking a hard line, saying he will consider supporters' calls to reinstate the death penalty, a move that would defy international rights conventions and perhaps irrevocably shatter Turkey's hopes of joining Europe as a full partner.

Mehmet Simsek, Turkey's deputy prime minister, said the rule of law will be upheld during the state of emergency and "we will use it in a fashion closer to our allies, like France and others."

And while Erdogan thanked political opposition parties for opposing the July 15 coup attempt, some analysts believe his triumphalist declarations show he is inclined to target rivals after a coup scare that exposed vulnerabilities in his security. The extent of purges, aimed at supporters of Fethullah Gulen, a U.S.-based cleric and former Erdogan ally blamed for the uprising, raised speculation that the rebellion fallout accelerated plans to overhaul Turkish institutions, accomplishing in days what might have taken years.

"Erdogan has always envisioned remaking Turkish society and undoing what he sees as the excesses of Kemalism," the secular ideology of Turkish national founder Mustafa Kemal Ataturk, wrote Howard Eissenstat, an associate professor of Middle East history at St. Lawrence University in Canton, New York.

"Now he is doing so with far greater force; this is a revolution. In 1980, the generals staged a successful coup aimed at totally remaking society. It was accompanied by mass detentions, purges of public institutions, and desperate violence. It appears that Erdogan will use the failed coup of 2016 for much the same aims, with much the same result," Eissenstat wrote in an email to The Associated Press.

The hostility driving some of the change was on display Sunday at a funeral for a friend of Erdogan's who died in the coup violence. With the president in attendance, a cleric prayed for divine protection from "the malice of the educated" — an apparent reference to the extensive network of schools run by the followers of Gulen, who has denied involvement in the coup attempt. But the criticism could also apply to other elites, including secularist circles that once controlled Turkey with military support.

Turkey experienced a revolution in 1923 when Ataturk, a war hero who founded the Turkish republic as colonial powers gobbled up former Ottoman territories, abolished the caliphate and its traditions of dress and language, viewed as symbols of stagnation, and turned to the West as a model. Ataturk's face still adorns Turkish banknotes, but Erdogan's Islamist-rooted government has diluted his secular legacy and turned to the Ottoman imperial era for ideas about morality and regional stature.

Many Turks critical of Erdogan are keeping a low profile as the post-coup purge unfolds, but the president's supporters appear invigorated. Necati Alkan, a resident of Istanbul's Fatih neighborhood, said: "From now on, we will spread justice in Turkey just like the Ottoman empire did for 600 years."

Metin Kadir, a resident of the capital, Ankara, said a state of emergency is the right move and declared: "I hope this country unites and is at peace again. Thank God we live in a country that is a paradise."

___

EDITOR'S NOTE — Christopher Torchia was Associated Press bureau chief in Turkey from 2007 until early 2013.

___

Associated Press writers Bram Janssen and Cinar Kiper in Istanbul contributed to this report.