ISTANBUL — The skyline of this most cosmopolitan of cities also tells the political narrative of Turkey and the strains that may decide its future. Minarets from a thousand mosques implore the skies in the name of Islam while multistory buildings proclaim the secular ascendancy that is the 20th-century heritage of this country.

Modern Turkey — population 74 million — was the creation of Kemal Atat￼rk who, with his band of “Young Turks,” took the ruins of the Ottoman Empire and by force of will and vision decreed that Turkey would put aside Islamic governance and favor the secular ways of the West. He left a powerful military that has acted, since the creation of the state, as the guarantor of the secular tradition he founded.

When the government in the nation’s capital, Ankara, has wavered, the military has stepped in.

Starting in 2003, a different kind of strong leader has dominated Turkish politics and has both swung the country toward its Islamic roots and brought about a decade of economic expansion. He is Recep Tayyip Erdogan, who heads the Justice and Development Party (AKP), an unashamedly Islamist-leaning political concoction.

Erdogan draws his strength not from the prosperous elites with their expensive apartments in Istanbul and their equally expensive summer homes in seaside resorts, like Bodrum on the Aegean, but from the pious rural peasantry, who have been forgotten in the rush to modernization.

As you move East in this country, you move away from this city with its stylish women and international stores to a land that is more religious and feels more threatened. Or go from the beaches of the Aegean, where tourist girls frolic topless, to a few miles inland where many women are covered from head to toe in black robes, and nearly all wear headscarves.

It is not just that Erdogan has found a neglected and distraught base of support in rural Turkey, but he is also an uncommonly attractive leader. The word “charismatic” is, in his case, truthfully applied.

Watch him on television and, even if you do not speak a word of Turkish, you can see why he has been politically unassailable.

Now his term as prime minister is about to come to an end, as he bumps up against term limits. He is expected to do, as Vladimir Putin did in Russia, sit out a few years as president, which has become a more powerful office under a constitutional change.

He will leave behind a state that is more Islamist, prosperous and determined to be an even greater regional power than it already is.

But despite Turkey having the largest military in NATO, after the United States, and being a firm U.S. ally, the West cannot look to Turkey for axiomatic loyalty, as has been the case in the past. Erdogan has defanged his own military — who have been the guardians of the secular state — by appointing officers loyal to him, and loosened the once firm ties with Israel. He has largely abandoned any hope of Turkey being allowed into the European Union.

Turkey has priorities of its own. Just two of these are settlement in Cyprus that will allow Turkey to become a conduit of natural gas from the Eastern Mediterranean to Europe, and a settlement with the Kurdish minority after years of insurgency.

The large gas fields lying off the coasts of Egypt, Israel, Lebanon and Cyprus, have geopolitical ramifications for the Middle East and far into Europe — all the way to Russia.

Atat￼rk essentially held Islam at bay. He prohibited men wearing the brimless hats that Muslims favor for prayer, adopted the Roman alphabet, barred women from wearing the veil in public places, and relegated religion to the mosques.

Erdogan has re-established religious rights and not discouraged Muslims to wear traditional dress, while pushing forward an industrial society. Sometimes, as with the recent mine disaster in Soma, where 301 miners were killed, the price of this push to free-market industrialization has been high.

Erdogan has been held accountable, but will almost certainly survive politically — as he has survived corruption scandals.

“The elites forgot about the people and he reached out to them,” an observer, who has lived the elite life, told me.

One way or other, it is unlikely that we have heard the last of Erdogan when he leaves the prime minister’s office in August.

He may not be another Atat￼rk, but he has modified the vision of the father of his country and left it straddling two visions — the way it straddles the Bosporus between Europe and Asia.