When the Taliban last ruled Afghanistan 20 years ago, the group banned music, outlawed human images and idols and blasted away two 1,500-year-old Buddha statues — an act of desecration that shocked the world.

Now the Islamists are back in power, and Afghan artists and filmmakers — many who flourished during the past two decades — are scrambling to hide, protect or even destroy books, paintings and other works of art.

Throughout history, conflict, political and religious upheaval, and abrupt changes in government have forced the artistic and intellectual class to conceal cultural creations both as an act of survival and to preserve the heritage itself.

Sometimes people safeguard art and artifacts to shield them from physical destruction during war — or in the hopes that others won’t plunder them for money. In some cases, art and cultural heritage are targeted as threats to authoritarian regimes.

Here are some places in past decades where art, artists and culture went underground.

Iraq: 2003

After the 1991 Persian Gulf War, Europe’s art market was flooded with treasures plundered from Iraqi museums by mobs opposed to Saddam Hussein’s government. So when the United States geared up to lead an invasion of Iraq in 2003, staff at the National Museum in Baghdad moved quickly to protect some of the most important artifacts.

Museum personnel scrambled to tuck the relics away in secret storage, blocking doors and lining them with sandbags and foam, said Corine Wegener, director of the Smithsonian Cultural Rescue Initiative. Some items were stored deep and sealed off behind painted concrete walls.

“There was some sense that they didn’t know what U.S. soldiers might do. They didn’t know what their own people in the area might do” amid the chaos of war, said Wegener, who deployed to Iraq as arts, monuments and archives officer in the Army Reserve.

“As in any major disaster or political instability, things can turn pretty quickly from safe to not safe — depending on what certain bad actors in the population thought they could get away with,” Wegener said.

Some of the subterfuge worked, but not all of the artifacts were protected. Looters still made off with some of the country’s most significant vases, tablets and statues — such as the Mask of Warka, one of the oldest depictions of a face, or a duck paperweight from 2070 BC.

At the Smithsonian, Wegener now helps train institutions on emergency planning for evacuations or safe storage of art and artifacts in times of human conflict or natural disasters.

Her work included helping store movable collections from the Mosul Cultural Museum ahead of the Islamic State takeover of much of northern Iraq in 2014. By that time, most of the collection was already in storage, she said.

“So what ISIS was able to intentionally destroy in that museum, it was tragic, it was many, many, many objects,” she said. “But it could have been so much worse.”

Cambodia: 1975

Cambodia’s Khmer Rouge regime seize power in 1975 and systematically targeted artists, intellectuals and musicians as part of a brutal campaign to remake the country as a classless agrarian society.

Some people targeted by dictator Pol Pot’s genocide — painters, writers, performers and others — survived by posing as taxi drivers or stashing away evidence of their crafts. The regime allowed some musicians to continue to perform, as long as the music served its interests.

“We almost lost our cultural identity because the Khmer Rouge targeted the artists,” according to Phloeun Prim, executive director of Cambodian Living Arts, an organization dedicated to reviving Cambodian art and cultural identity. The organization was founded by a musician who survived the Khmer Rouge because he was forced by the regime to perform propaganda.

But “we never lost our artistry,” he said.

Even as Cambodian refugees fled between 1975 and 1979, some people were gathering children in camps to teach them music and traditional dance.

“We were leaving behind our country,” Prim said. “But we had to preserve our cultural identity.”

Mali: 2012

The Malian city of Timbuktu was long home to libraries full of ancient manuscripts — collections of scholarly works, poetry, letters and copies of the Koran.

When Islamist insurgents seized the city in 2012, they began burning libraries with texts that they deemed “idolatrous.” But an ambitious operation to evacuate and protect the precious manuscripts was already underway.

Using cars, carts, canoes and even fruit crates, groups of librarians, book collectors and local families transported the texts in metal boxes to private homes and other safe places around Timbuktu, the BBC reported. They rescued their city’s heritage piece by piece, ferrying it out first in vehicles and then later by boat, according to National Geographic.

Germany: 1933

Adolf Hitler, as German chancellor in the early 1930s, opposed modern art as “degenerate” and said that it was a mark of society’s moral decline. But his move to confiscate art was motivated by both commercial and ideological concerns.

His Nazi regime seized radical art pieces from state-owned museums, destroying some while selling others to prepare for war.

As a result, some modernist artists and collectors began hiding their art to prevent confiscation by Nazi troops. A stash of roughly 1,500 modern works were found buried “among stacks of rotting groceries” in Munich in 2013.

Both before and during World War II, many museums in Europe and Britain moved, hid and stored parts of their collections to protect original or irreplaceable works from air raids and firebombing.

“Hide them in caves and cellars, but not one picture shall leave this island,” Winston Churchill said in 1940 of the collection at the National Gallery in London.

Some paintings were stored safely underground in slate mines in Wales. The British Museum also sent precious works by Michelangelo and Raphael to an underground cave equipped with a heating system, the BBC reported.

The Louvre in Paris almost completely emptied its collection into scattered safe houses in the French countryside. Notably, Leonardo da Vinci’s Mona Lisa was sent to five different evacuation locations during the war.

Iran: 1979

In Iran, one of the world’s valuable collections of modern art is on display deep underground, accessible via a spiral staircase.

The Tehran Museum of Contemporary Art is the permanent home to Van Goghs, Picassos and at least 15 pieces by Andy Warhol. Some of the paintings — such as Jackson Pollack’s “Mural on Indian Red Ground” and works by Mark Rothko are valued in the hundreds of millions

During the revolution of 1979, the museum took its 1,500-strong collection into a basement vault. There are double doors: first, a heavy door with a deadbolt and then another six-inch steel door with a combination lock, Bloomberg Businessweek reported. The main gallery was used to display propaganda after the revolution. The vault-protected collection remained largely intact.

Sudarsan Raghavan contributed to this report.