On the set of “Magnificent Century,” a soap opera that depicts intrigues at the court of Süleyman the Magnificent. Photograph by Ed Kashi / Vii / Corbis

On the way to the Sultan’s harem, I saw two beautiful slave girls walking across a parking lot clutching their tiaras and squinting unhappily into the sun. It was a hot August day in Istanbul, with an intermittent gusting wind. An attendant ushered me into a warren of royal chambers. I crossed the marble flagstones of a capacious Turkish bath, and proceeded down the passageway known as the Golden Road, through which a lucky concubine, having received the purple handkerchief indicative of the Sultan’s favor, approaches the privy chamber. On a gilt desk lay an imperial seal and two sticks of wax. An adjacent bedroom, lavishly appointed, had been occupied by the Sultan’s mother, until her death, toward the end of Season 2.

“Magnificent Century,” a soap opera set in the court of Sultan Süleyman the Magnificent, has been breaking Turkish television records since its première, in 2011. Every Wednesday, more than a third of prime-time viewers tune in to watch the latest ninety-minute episode. Süleyman, who reigned from 1520 to 1566, is known in Turkey as the Lawmaker, renowned for his innovative legal code, for the opulence of his court, and for expanding the Ottoman Empire from Transylvania to the Persian Gulf. It was Süleyman’s Army that defeated the Hungarian forces at the Battle of Mohács and launched the first Ottoman siege of Vienna, though the plot of “Magnificent Century” focusses more on the life of the harem, and the intrigues among Süleyman’s wife, concubines, mother, sisters, children, and viziers.

“Magnificent Century” is part of a Turkish trend called Ottomania, manifested in such diverse phenomena as Burger King’s Sultan meal combo (a 2006 TV spot featured a Janissary devouring a Whopper with hummus), a proliferation of Ottoman cookbooks, Ottoman-style bathroom consoles, wedding invitations with Ottoman calligraphy, and graduation gowns and flight-attendant uniform designs inspired by caftans and fezzes. In the past ten years, there have been increasingly elaborate commemorations of the Ottoman conquest of Constantinople, in 1453, along with the construction of new Ottoman-style mosques and the renovation of old Ottoman buildings, some of which have been repurposed as hotels or shopping malls. Last spring, protests were triggered by Prime Minister Recep Tayyip Erdoğan’s decision to raze Gezi Park, in central Istanbul, in order to build a shopping mall in the style of an Ottoman barracks. The Gezi protests subsequently escalated into the most widespread civil unrest in Turkey in more than a decade. Five protesters were killed and five thousand detained. Many remain in custody.

On the surface, “Magnificent Century” looks like a quintessential product of the Erdoğan years. Thanks to Erdoğan’s economic policies, Turkey has a thriving television industry, capable of staging elaborate period dramas, and a prosperous family-oriented middle class of observant Muslims eager to watch their own values reflected in a historical imperial setting. And, much as Erdoğan’s foreign policy has promoted relations with former Ottoman lands, the show has conquered large audiences in Balkan, Caucasian, and Arab countries not known for their fond memory of Ottoman rule. Broadcast to more than two hundred million viewers in fifty-two countries, “Magnificent Century” has accomplished one of Erdoğan’s main goals: making a powerful, non-secularist, globally involved version of Turkey seem both plausible and appealing.

And yet Erdoğan is not a fan. In late 2012, at the opening of a new provincial airport, he took a moment to condemn the show’s depiction of Süleyman, as well as its directors and broadcasters, hinting at severe judicial repercussions. Soon afterward, an M.P. from Erdoğan’s party declared that “Magnificent Century” would be discontinued. A bill to protect the Sultan’s memory was submitted to parliament. Turkish Airlines excluded “Magnificent Century” from its in-flight programming. Conservative viewers had already objected to the amount of time Süleyman spent in the harem; to a chalice from which he occasionally drank some unknown, potentially alcoholic beverage; and to the low-cut gowns of the harem women. When “Magnificent Century” first aired, Islamist demonstrators marched to the television-station offices and threw eggs at the building, while a man dressed as Süleyman read out an “imperial edict” denouncing the show.

Things have reached a certain benchmark when one man in a Süleyman suit is issuing edicts against another man in a Süleyman suit. This benchmark was passed in June, when the actor who plays Süleyman joined the anti-government protests in Gezi Park. Photographs in the papers showed him wearing a Bob Marley T-shirt, with a surgical mask to protect against tear gas. A week later, he was one of ten cultural figures and activists summoned to Ankara for a late-night meeting with Erdoğan. Participants later reported that, when the subject of disproportionate police force was broached, the Prime Minister turned to the actor and said, “As you must know, the Lawmaker Süleyman also had a harsh temper.”

The Ottoman Empire was founded in 1290, by a Turkoman tribal leader called Osman, and survived until the First World War. Encompassing, at one point, territories from Algiers and Athens to Zabid and Nové Zámky, it nonetheless lacked many of the features that we associate with empire. Until the nineteenth century, the economy was based on agriculture, not trade; new territories weren’t mined for raw materials or settled by colonists; and there was no imposed official language. Although the Ottomans saw themselves as Muslim conquerors, they generally granted religious freedom in exchange for higher taxes. The relatively peaceful coexistence of a diverse population under this system of taxed tolerance is sometimes described as the Pax Ottomana.

The decline of the Ottoman Empire, which began around the seventeenth century, has been variously ascribed to debt, decentralization, conflicts with Russia, and a run of subpar sultans. In the nineteenth century, a wave of nationalistic revolutions swept Europe and reached the Ottoman provinces in the Balkans. The Ottomans had no use for nationalism. During the First World War, which ushered in the end of multinational empires and the rise of nation-states, they sided with Germany and the Austro-Hungarian Empire. Some of their Arab territories, hoping for self-determination, joined the Allies, a “betrayal” that the Ottomans neither understood nor forgave. In 1920, the Treaty of Sèvres, even harsher in its terms than the Treaty of Versailles, dismantled the Ottoman Empire, handing control of its economy and military to the Allies. The Arabian Peninsula was granted independence, and Britain and France carved up the remaining Arab territories. Greece got Eastern Thrace and Izmir. Eastern Anatolia was divided between an independent Armenia and an autonomous Kurdistan, and the Dardanelles became an international waterway.

Just after these terms had been negotiated, a resistance army rose up against Greece and the Allies, and against the Ottoman holdovers who ran what remained of the state. Its leader was Mustafa Kemal, who had been a front-line commander in the Ottoman victory at the Battle of Gallipoli, and who later became known as Atatürk: Father of the Turks. The War of Independence ended with the expulsion of the Allies and the formation of the Turkish Republic, an outcome perceived in the Muslim world as an Islamic triumph over Western imperialism.

The way was open for Atatürk to fashion himself as a pan-Islamic leader, or a global anti-imperialist. Instead, he set about inventing a radically secular, radically nationalist “Turkish” identity. Though Europeans since the twelfth century had used the Latin name Turchia to designate the lands of the Turks, the Turks themselves had no such geographical or political concept. The first official state history, published in 1930 and used as a basis for school textbooks, characterized the Turks as an ancient Central Asian people with a long pre-Islamic history, including the Sumerian and Hittite civilizations. A scant fifty-two of its more than six hundred pages were devoted to the Ottomans, who were described not as the nation’s forebears but as a family of decadent profligates who had sold the Turks to Europe.