KABUL — A young woman lounges in a meadow, daydreaming about her love. Her friend sings and decorates her long hair with freshly picked flowers. Suddenly, she perks up to the clip-clop of an approaching horse. “Sharif is coming!” she cries out, jumping up to run toward him.

In Afghanistan, movie scenes like this one — released just before the outbreak of civil war in 1992 — were once an essential part of the country’s rich culture. Then, in the mid-1990s, the Taliban banned them — destroying some reels of film and leaving others to decay in storage.

Now, an elite team of film archivists here is working to conserve them as part of a years-long government program that aims to digitize about a century’s worth of Afghan documentaries and films over the next six months.

The project coincides with negotiations between the United States and the Taliban, which have raised both hopes for an end to the 18-year war and fears the Taliban could return to power. Once finished, some clips from the digitized movies will be made available to download online and others will be screened at mobile theaters across Afghanistan — even, the archivists hope, in some of the many areas that remain under Taliban control.

“Archives are the identity of a country,” said Sultan Mohammad Istalifi, 72, a longtime employee of Afghan Film, the state-run film company, who is part of the digitization team. “If the archive is not preserved, the identity of the country is lost.”

Old film reels, some still waiting to be restored, sit behind a biometric lock in a room in the basement of a building on the palace compound in Kabul. (Kiana Hayeri for The Washington Post)

That the films have survived this long is something of a miracle.

Afghan Film opened in the late 1960s with help from the United States and went on to oversee the production of movies across Afghanistan over the following decades.

But when the Taliban took over the government in Kabul in 1996, the militants enforced a strict version of Islamic law, banning music and moving images. Under their rules, just seeing a woman’s face in public was deemed immodest. To see one appear on screen — pining for a man, her hair uncovered — would have been considered sacrilegious.

Afghan Film staff knew the Taliban’s hard line interpretation of Islam put them and their films in danger.

Fearing the militants would destroy their irreplaceable archive, some employees risked their lives to hide the films, piling as many reels as they could in the building’s ceilings and walls. When the Taliban eventually stormed the company’s headquarters, militants burned much of what they found.

“I felt as if I were at a funeral,” Habibullah Habib, 61, a film projectionist who helped hide the films decades ago, said of that day. “The air was full of grief.”

Habibullah Habib is helping to restore, digitize and archive the reels. He helped hide the films when the Taliban took control over the government in Kabul in 1996. (Kiana Hayeri for The Washington Post)

Many of the movies survived in their hiding places until after the Taliban government fell in 2001. But in the shadow of the drawn-out war that followed, many of those films were neglected and damaged.

Efforts to protect the surviving films by digitizing them began years ago, but with funding and equipment shortages, the process stagnated. Then, last year, the archives staff at Afghanistan’s presidential palace took over the project and moved the reels from the historic Afghan Film headquarters into a climate-controlled room in the basement of a gray building on the far side of the palace compound in Kabul, where they now sit neatly stacked behind a heavy door with a biometric lock.

Critics accused the government of moving the films out of reach of the general population by barricading them on one of the most secure compounds in an already militarized capital. But Rafiullah Azizi, director of the palace archives, said relocating the reels was the only way to ensure they would survive whatever happens next in Afghanistan.

“Afghanistan has been destroyed and the movies are no exception,” he said. “They need to be taken care of like a baby.”

Some of the films were “almost ruined” when they were transferred to the palace, he said. The already fragile film was often unlabeled, ripped or covered in dust.

Now, six days a week, in a windowless room on the second floor of the building where the films are housed, four men sit at desks in different corners, diligently cleaning and repairing the 16- and 35-millimeter film, one strip at a time.

One gently wipes dust off the film with a small brush while another plays an old movie on a small screen, closely scrutinizing its sound quality and making careful adjustments. Once a reel of film has been properly repaired, the staff project it onto a large screen, taking notes about its content and any remaining glitches before registering it in a database.

Then the film is placed inside a $30,000 machine that transfers its contents onto a connected computer. A second group of experts then pore over individual scenes, using software to tweak the newly digitized version’s sound and color until every detail feels right.

Habibullah Habib works on restoring a film in his office. The archivists see restoring these films to their original condition as a crucial service to their country. (Kiana Hayeri for The Washington Post)

The archivists working here see restoring these films to their original condition as a crucial service to their country — as important as the work others are doing to slowly rebuild other artifacts the Taliban has destroyed, like the centuries-old Buddhas they once smashed to pieces that experts are now carefully reconstructing at the National Museum in Kabul. Once the film digitization project is complete, they plan to move copies of some films to embassies abroad to ensure their protection.

Mamnoon Maqsoodi — one of Afghanistan’s most beloved actors, who is best known for his role as a simple villager on his first trip to Kabul in the comedy “De Konday Zoy,” which screened shortly before the Taliban came to power — said film is treasured here because movies are a coping mechanism, offering momentary respite for Afghans worn down by decades of war.

“Movies are the mirror of a society — the mirror of both its problems and its successes,” Maqsoodi said. “Cinema can give a lot, and connect people who hate each other.”

Since the war began, Maqsoodi said, he has never played the role of a Taliban fighter. But he has played the part of their victims, and in doing so, has sought to portray the harm the militants wrought on his country.

“If I can take revenge through acting and making films, I would never pick up a gun,” he said.

On a recent afternoon, Habib, the film projectionist, gently placed 16-millimeter film onto a yellow reel projector, then cranked its handle and peered through a small window where he could see it appear on the screen in a room next door.

Bit by bit, scenes from an earlier Afghanistan came to life.

It was the 1970s, and young women, their hair uncovered, skipped joyfully through a public park in Kabul. Teenagers marched proudly in a parade at a stadium in the capital. Vendors bustled on streets not patrolled by the military.

Nazifa Hashemi watches and analyzes a film from the archive that was shot in the 1960s. Seeing the Kabul she once knew before the Taliban can be difficult, but the films also give her a sense of pride. (Kiana Hayeri for The Washington Post)

For Nazifa Hashemi, 58, who is contributing to the films’ restoration by analyzing and categorizing their content, watching these familiar scenes can evoke painful memories.

As a young woman in Kabul, she moved around town as freely as the women on screen, dressed in miniskirts and high heels and mingling with men at picnics. But when the Taliban came to power, she was forced to cover herself in a blue burqa. Most of her family fled to the United States.

Sometimes, the films remind her of how much she’s lost. But they’re also a source of pride and inspiration — a reminder of how much Afghans have left that’s worth trying to save.

“As long as we are alive, we want to see our country, our people, from the beginning to the end,” she said. “Never will I love anywhere else in the world as much as I love my own land.”

Shoaib Harris contributed to this report.