KABUL - American historian Nancy Hatch Dupree, who dedicated most of her life to preserving Afghanistan's heritage, died in a Kabul hospital on Sunday aged 89.

Dupree first arrived in the Afghan capital in 1962 as the wife of a diplomat. In the city she met her second husband, the late American archaeologist Louis Dupree, and developed a lifelong passion for the Muslim country. Over the next five decades she travelled throughout the country, wrote five guidebooks and documented the war-torn nation's past.

Her death was confirmed by Waheed Wafa, executive director of the Afghanistan Center at Kabul University where tens of thousands of documents preserved by the Duprees are kept.

Many Afghans took to Twitter to pay tribute to Dupree - sometimes referred to as Afghanistan's "grandmother" - who was widely respected for her efforts to safeguard the country's history and culture.

"Very saddened by the death of #NancyDupree. Afghans value and respect her services of decades for #Afghanistan. Nancy will be missed! RIP," wrote Afghanistan's Chief Executive Abdullah Abdullah.

Activist Mariam Wardak posted: "You were a blessing, your work will remain a treasure, you are loved and will be missed by the people of #Afghanistan."

"The incredible Nancy Hatch Dupree has passed, 50 years dedicated to preserving Afghanistan's historical docs & artifacts #Kabul #Afghanistan," wrote actress Fereshta Kazemi.

US special charge d'affaires Hugo Llorens, America's top diplomat in Afghanistan in the absence of an ambassador, said Dupree had been a "pillar of the American community in Afghanistan" and would be "forever remembered".

Dupree and her husband lived in Afghanistan until the late 1970s when they were forced to leave by the communist government.

They spent time in the Pakistani city of Peshawar helping Afghan refugees fleeing the conflict during the Soviet occupation of 1979-89 and collecting documents relating to Afghanistan.

Dupree's husband died in 1989 and she moved back to Afghanistan after the US-led invasion that toppled the ruling Taliban in 2001.

With the help of the new government, Dupree created a centre to preserve the couple's priceless collection of records for researchers. The Afghanistan Center houses more than 100,000 documents in the country's two official languages, Dari and Pashto, as well as English and other European languages.

The centre also provides reading materials to hundreds of libraries around the country, a reflection of Dupree's belief that knowledge was key to Afghanistan's recovery from decades of conflict.

"Afghans possess a remarkable inner strength that has carried them through two decades of war and displacement. If they are given the knowledge they need to fully participate in reconstruction efforts, their country will move forward steadily, to the benefit of all," Dupree wrote in the New York Times in 2008.