ISLAMABAD — Nancy Hatch Dupree was a rare American fixture in Afghan life and lore for half a century; a petite, adventuresome historian and bonne vivante whose efforts to preserve Afghan history and artifacts from the vicissitudes of conflict survived the Soviet invasion, the civil war and the Taliban.

She was still at it, organizing and running an archival center of 60,000 Afghan documents at Kabul University, when she died early Sunday at age 90 in a hospital in Kabul. Waheed Wafa, a spokesman for the center, said she died of protracted heart, kidney and lung problems.

By midmorning, accolades and affectionate remembrances were pouring in from diplomats and preservationists, Afghan officials and Western friends spanning several eras.

“Future generations will remember Ms. Dupree as a wonderful example of the strength of U.S.-Afghan relations and friendship,” Hugo Llorens, the special charge d’affairs at the U.S. Embassy in Kabul, said in a statement. He described her as “a pillar of the American community” and said her “love for this country and dedication to its culture and history will be forever remembered.”

“The grandmother of Afghanistan has passed away,” Sattar Saeedi, an Afghan journalist, posted on Facebook.

Nancy Hatch was far from grandmotherly when she arrived in Kabul in 1962 as the wife of an American diplomat. Raised in India, where her father directed agricultural projects, she had studied Chinese history at Barnard College and Columbia University. She was 34, curious about Afghanistan and quickly bored with embassy teas.

She soon met Louis Dupree, a young ethnographer and archaeologist from North Carolina, who was also married. They fell in love, weathered the ensuing scandal, remarried and spent the next 25 years engrossed in a tumultuous romance with Afghan history, society and culture.

At first, during an era of liberal modernization in the Afghan capital, the Duprees became famous for throwing cocktail bashes known as “five o’clock follies.” Together, Wafa wrote in a lengthy tribute Sunday, “they galloped their horses, danced late into the night, and celebrated their marriage on a hilltop overlooking their beloved Kabul.” Meanwhile, she wrote guidebooks and he researched ancient settlements.

That heyday crashed with the Soviet invasion of 1979. Louis Dupree was briefly imprisoned by the Moscow-backed Afghan government and the couple fled to the United States, settling into university life in North Carolina. Later they moved to Peshawar, Pakistan, a nerve center for Afghan refugees. There they founded a resource and information center, collecting Afghan documents that would eventually form the basis of the Kabul University center.

Louis Dupree died of cancer in 1989, the year the Soviets pulled out of Afghanistan, but Nancy carried on their research, writing and collecting efforts. She waited out the civil war in Pakistan but said she made contacts with moderate Taliban officials after they took power in 1996, hoping to help preserve historic artifacts. Once, she said, she briefly met Osama bin Laden, the al-Qaida leader who orchestrated several terrorist attacks, including the 9/11 attacks in the United States.

In 2005, three years after the return of civilian rule, she lugged a trove of material back to Kabul in agricultural sacks. The next year, she founded the university center and began curating thousands of documents reflecting years of conflict and political upheaval, refugee work and international involvement in Afghanistan.

Already in her 80s, Dupree once again became an active presence in Kabul. Charming but formidable, she pushed officials and donors to support her work, and befriended a new generation of foreigners intrigued with Afghanistan’s story. She always spoke of carrying on her late husband’s mission, but by then it had become mainly associated with her.

“No one who met her could ever forget her,” Lyse Doucet, a BBC correspondent who visited Dupree often, posted on Facebook. “She did so much to preserve the history of Afghanistan … she takes some of it with her but leaves so much behind.”

In 2013, after numerous delays, the university center opened in a majestic new building of Afghan stone, marble and cedar. Dupree was eager to make it attractive to Afghan students, not just visiting scholars. In an interview with The Washington Post in 2015, she said many young Afghans had grown up in refugee camps and learned little about their nation’s history.

“They don’t have a sense of belonging to Afghanistan, of what does it mean to be an Afghan,” she said. “What we are trying to do is inject this idea that to have a sense of identity is what makes you strong.”

Dupree, many of her admirers noted, remained strong to the last, fussing about organizing slides and promoting the university center even from her hospital bed.

“Her body was frail but her spirit and passion for her work was alive and well,” said Andrew Wilder, executive director of the U.S. Institute of Peace in Washington, D.C., who visited her at Kabul’s Amiri Hospital on Friday. He said she spent much of their conversation insisting that he tour the university center while in Kabul.

“It is a very fitting legacy to her and her husband,” Wilder said. “It was her pride and joy.”