It takes a particular kind of building to survive 800 years in Baghdad.

It can't be too showy, or it might prove irresistible to looters. It can't be too prominently placed, or it might fall foul of urban planners. University, barracks, customs office, hospital: its design must allow for myriad uses. Even then it must be sturdy because the city’s many conquerors have often been exceptionally clumsy.

The squat, thick-walled Mustansiriya School is just such a building, and that's perhaps why it, and almost it alone, remains standing from Baghdad’s medieval Abbasid era. While most of its peers crumbled through invasion after invasion, or as the city lapsed into centuries of decay as a backwater of the Ottoman Empire, the Mustansiriya endured, adapting to each of its occupiers' needs. Though Baghdad was one of the world’s cultural and scientific powerhouses from the 11th until the early 13th centuries, only a dozen or so structures remain from that period.

At the end of World War I, when the British—and a few decades later the Baathists and Saddam Hussein—took over, they steamrolled much of what remained of old Baghdad in order to 'modernize' the capital. Enticed by Iraq’s resources and drawn to its strategic location en-route to India, Britain was quick to snap up some of the vanquished Ottomans’ holdings after they had thrown their weight behind Germany during the war. In Baghdad, British administrators launched into a series of urban renewal projects to cement their rule. The school seemingly escaped because of its location – a narrow, easily forgotten strip along the Tigris river. ‘It’s our great survivor,” says Hussein Ali Hussein, a shop owner in the Souk Daniel, a once mostly Jewish cloth market that flanks the Mustansiriya. “We feel proud when we see this beauty around us.”

But if it has sometimes seemed as though the school has overcome every obstacle history could throw at it, recent years have provided its biggest challenge yet, one that could still prove its undoing. As a relic of past glories in a country in which heritage has often been politicized, the Mustansiriya risks becoming another pawn in partisan games. And as a vulnerable structure in need of regular maintenance, it is hostage to the priorities of under-funded and allegedly corrupt antiquities authorities. Now that Baghdad is once more clambering back to its feet after ISIS’s territorial defeat, observers wonder: Can the school regain anything of its past glory or will it – and the city around it – continue their long, slow decay?

I first visited the Mustansiriya in early 2014 while hunting for remnants of Baghdad’s past, and it was indeed a sorry sight. The upper walls were pockmarked by car bomb fragments from bomb blasts. The lower walls along the river embankment were scorched by garbage fires, an illegal practice that took off amid the general breakdown in law and order after the 2003 invasion by U.S. forces. Worse yet, the entire structure was at risk of collapse. “We’re concerned about the foundations. There’s been a lot of water damage,” Faisal Ahmed, a government engineer, told me in 2015. What little drainage the building had was insufficient to prevent parts of it from flooding during the winter rains.

Built between 1227 and 1234 by Al-Mustansir, the penultimate Abbasid caliph in Baghdad, the Mustansiriya was one of the first universities in the world. Its library stocked books on everything from medicine to mathematics and Islamic jurisprudence, and the lectures boasted students from as far afield as Yemen and Syria. Ibn Battuta, the legendary Moroccan traveler, was taken by the when he visited in 1327. As he wrote, “The teacher takes his place under a small wooden canopy, on a chair covered with rugs; he sits in a grave and quiet attitude, wearing robes of black and his turban, and with two assistants on his right and left, who repeat everything that he dictates.”

As the third of the Islamic caliphates, the Sunni Abbasid dynasty presided over much of the Muslim world, but its spiritual authority wasn’t accepted by Shia Muslims, whose chosen candidate had lost out in the battle of succession after the prophet Mohammed’s death in the 7th century. Even today, in post-invasion Iraq, a minority of extremist Sunnis and Shiites are quick to amplify these historical distinctions to further drive a wedge between their communities.

But no sooner had construction finished than the city’s golden era ended. The Mongols, under Genghis Khan’s grandson, reduced much of it to ruins in 1258. The ruling Ottomans shipped the school’s library off to Constantinople in the 16th century, thereby ending the building’s use as a university. Between war, neglect and damaging Tigris mega-floods, there’s been little to celebrate ever since.

“By the 1930s, it was in a very sorry state. You should see early photographs,” the late Lamia Al-Gailani Werr, Iraq’s most prominent 20th century archaeologist, told me in 2017 (she died early this year). “But restoration work started in 1944, and by the mid-50s a large portion was complete. As students of the archaeology faculty, we had lectures there. It was a wonderful atmosphere. But because of corruption and cutting corners, all that work was ruined. Like Baghdad, we allowed it to rot. It’s shameful.”

Initially, though, it looked as if the Mustansiriya’s prospects might be looking up. Baghdad was nominated as the 2013 Arab Capital of Culture, and officials were keen to spruce up its marquee attractions. With the city also more or less at peace, state conservators were put to work on a renewed round of restorations. They reconditioned the school’s farshi, the sand-colored brick from the holy city of Karbala with which the building was originally surfaced, and overhauled the guttering, some of the inscriptions, and parts of the damaged walls – though not without missteps. A leaky replacement water pipe caused serious damage to the north wall, according to Al-Gailani Werr.

But the school’s luck soon took another turn for the worse. ISIS surged in from the west and north in the summer of 2014, pulling to within 30 miles of the capital at one point. Foreign conservators across the country fled, a particular problem because Iraq lacks specialists with conservation and restoration training, as the nation was under sanctions throughout the 1990s. Amid the chaos of war, unscrupulous businessmen and landlords took advantage of the situation to bulldoze Ottoman and early 20th-century structures at a record pace and replace them with bigger, taller concrete buildings—even though everything over 100 years old ostensibly qualifies as a heritage site and is in theory protected by law. It wasn’t just private individuals getting in on the act. Baghdad’s city government reportedly tore down a historic house in 2016 to build a shopping mall.

The state budget tightened, too. That sudden demand for higher military expenditures coincided with a rapid drop in global oil prices; the combination crushed most ministries’ investment spending. The Ministry of Culture, which absorbed the Ministry of Tourism and antiquities in 2015, is still cash-strapped. It has one of the smallest ministerial budgets, almost all of which goes to salaries and pensions for its roughly 14,000 civil servants—a figure that observers say is perhaps more than ten times what the ministry needs to perform its limited duties. “We really need a new generation in charge. So many of the current generation are just Baathist bureaucrats [Saddam-era civil servants]. You can’t use them,” says Saad Eskander, who served as director-general of the National Library from 2013-2015. “It’s like having a revolution and then using the reactionaries.”

And despite those shrinking funds, some of the money that had been allocated for the Mustansiriya’s restoration has gone missing. In a familiar old fraud, state building contractors allegedly requested payment for more workers than they’d committed to the project, while paying those on site less than they’d advertised, according to two former antiquities officials. “They bought materials of poor quality,” one of the former officials alleged. “It’s a big corruption.” The director-general of the State Board of Antiquities and Heritage, the body directly responsible for the school, wouldn’t comment on the state of its restoration, despite agreeing to meet with me and then failing to turn up on one occasion in 2016.

As if all of that weren’t enough, there was even a whiff of sectarianism to the school’s plight. Ministry employees and academics say that a number of senior officials, some of whom were until recently members of Shia Islamist parties, wanted little to do with a building so closely identified with the Sunni Abbasids. “The citizens of Baghdad, like all of Iraq, are different in their regard for the Abbasid rule, so some see it as legitimate, others say it was not,” says Bassim Al-Tamimi, a professor at Baghdad University. “Consequently, there’s no general agreement on the importance of this heritage, or of the attention it ought to receive.” While dispiriting, it would be far from the first time Iraq’s heritage has become snared in political machinations—Saddam Hussein infamously reconstructed part of Babylon, some of which dates back to the 18th-century B.C. with bricks inscribed with his name in an attempt to associate himself with Mesopotamia’s past glories.

Today, the Mustansiriya is largely closed off. When I’ve passed by on recent trips, the gates have either been shut or manned by bored-looking guards with instructions to admit no one. But there is reason to believe that happier times might be in sight. The city’s lone remaining Abbasid palace, which was out of bounds for most visitors for years because it flanks the heavily-fortified Ministry of Defense, has reopened to visitors, as has the Qishleh, the old Ottoman administrative center, and both the National Museum and National Library, all of which were heavily damaged in the aftermath of the U.S. invasion. Even Rasheed Street, the handsome, arcaded thoroughfare that the Ottomans began and the British finished to facilitate transit through the medieval core, is looking more polished than it has for years. If the authorities are serious about trying to entice tourists, as they’ve sometimes declared, the Mustansiriya will surely be front and center in their plans.

More importantly, perhaps, the political and social environment might be changing in ways more favorable to heritage. The new minister of culture is a highly regarded archaeologist. Newly emboldened activist groups are lobbying furiously for the protection of what remains of the historic center. And with Baghdad enjoying its most peaceful period in years, some of the checkpoints and concrete blast walls are disappearing—for the time being, at least. Residents are visiting their heritage sites with far greater frequency than in darker days when many spent as little time as necessary out on the streets.

The challenges are still formidable, for the Mustansiriya and Baghdad both. But having weathered worse times, they appear well-placed to endure whatever the future might hurl at them – if for no reason other than the alternative is too unthinkable for many Baghdadis to countenance. “This is one our last monuments from one of the city’s most important periods,” said Lamia Al-Gailani Werr. “It is important for us that it is protected. Because what is Baghdad if it loses all that history?”