The dimly lit, dust-caked stacks of the Baghdad National Library hide a treasure of the ages: crinkled, yellowing papers holding the true stories of sultans and kings; imperialists and socialists; occupation and liberation; war and peace.

These are the original chronicles of Iraq's rich and tumultuous history — and now librarians and academics in Baghdad are working feverishly to preserve what's left after thousands of documents were lost or damaged at the height of the U.S.-led invasion.

As Islamic State in Iraq and Syria (ISIS) militants set out to destroy Iraq's history and culture, including irreplaceable books and manuscripts kept in the militant-held city of Mosul, a major preservation and digitization project is underway in the capital to safeguard a millennium worth of history.

In darkrooms in the library's back offices, employees use specialized lighting to photograph some of the most precious manuscripts. Mazin Ibrahim Ismail, the head of the microfilm department, said they're testing the process with documents from the Interior Ministry under Iraq's last monarch, Faisal II, who ruled from 1939 to 1958.

"Once restoration for some of the older documents from the Ottoman era, 200 to 250 years ago, is completed, we will begin to photograph those onto microfilm," Ismail said. He said the digital archives, which will not be made available immediately to the public, is more to ensure their contents survive any future threat.

Manuscript microsurgery

The restoration process is nothing short of microsurgery, and the type of damage to each document is a story — and a puzzle — on its own. Some manuscripts are torn from overuse and aging; others are burned or stained from attack or sabotage. And then there are some that were completely fossilized over time — the combined result of moisture and scorching temperatures — looking instead like large rocks dug up from the earth.

As ISIS militants set out to destroy Iraq's history and culture, including irreplaceable books and manuscripts kept in the militant-held city of Mosul, a major digitization project is underway. (Karim Kadim/Associated Press) "Those are the most difficult books to restore," said Fatma Khudair, the senior employee in the restoration department. "We apply steam using a specialized tool to try to loosen and separate the pages.

"Sometimes, we are able to save those books and then apply other restoration techniques, but with others, the damage is irreversible," she added.

Technicians sterilize manuscripts and documents for 48 hours, washing them of dust and other impurities that accumulated over time. Then, they go page by page using Japanese tissue, specialized paper for book conservation and restoration, to either fill in torn edges or layer the more-delicate documents with a sheer coating to make them more durable.

The Baghdad National Library, established by the British in 1920 on donations and first overseen by a Catholic priest, has weathered violent upheaval before. At the start of the 2003 U.S.-led occupation, when chaos gripped the capital, arsonists set fire to the library, destroying 25 per cent of its books and some 60 per cent of its archives, including priceless Ottoman records. Archives from 1977 to 2003 burned to ashes. Earlier archives from 1920 to 1977, including sensitive Interior Ministry documents, had been stored in rice bags and survived the blaze.

During the invasion of Iraq, "we had an alternative site for the most important books and documents at the Department of Tourism," said Jamal Abdel-Majeed Abdulkareem, acting director of Baghdad libraries and archives. "Then books and the important documents were exposed to water because the American tanks destroyed the water pipes and water leaked onto these important cultural materials."

Precious Hebrew archives

A member of the library restoration staff works on a damaged document at the Baghdad National Library. (Karim Kadim/Associated Press) Around 400,000 pages of documents — some dating back to the Ottoman period — and 4,000 rare books were damaged when the pipes broke. They included the library's precious Hebrew archives, most of which later were moved to Washington.

A team of experts from the Library of Congress visited Baghdad to help assess the damage and recommended building a new national library. More than a decade later, a state-of-the-art, 45,000-square-metre replacement by London-based AMBS Architects is scheduled to open next year.

Until then, the Baghdad National Library is looking to help those in conflict-ridden areas enjoy and appreciate Iraqi culture. Library officials say that sharing Iraqi art and literature is key to combatting terrorism. In recent months, the library donated some 2,500 books to libraries in Iraq's Diyala province after Iraqi forces recaptured towns there from ISIS.

The militants "want history to reflect their own views instead of the way it actually happened," Abdulkareem said. "So when an area is liberated, we send them books to replenish whatever was stolen or destroyed, but also, so that Iraqis in this area have access to these materials so they can always feel proud of their rich history."