Despite Taliban gains and ISIS's emergence in Afghanistan, one amazing Kabul school continues to teach 4,000 students (half girls) to think independently and to believe in tolerance.

The private Marefat school, along with its founder, Aziz Royesh, and several girl students, is the subject of Jeffrey Stern's moving new book, The Last Thousand: One School's Promise in a Nation at War.

The book raises painful and very pertinent questions: Can liberal values take root in a conservative Muslim country that is threatened by Islamist radicals? And what will happen to Afghans who embrace those values after U.S. troops leave?

The answer to the first question is yes - with caveats.

When Gen. John Allen handed off command of U.S. troops in February 2013, he warmly welcomed two orphaned Marefat students, who were sitting in the front row of the ceremony. His emotions visible, Allen said they represented the future for which U.S. and Afghan troops fought.

I attended this ceremony - which provides the opening scene in Stern's book - and understand Allen's enthusiasm. What was achieved by the orphaned Somaya and Mustafa, and what Royesh had built - on his own, without U.S. or foreign help - was astounding. His own schooling cut short by the Soviet invasion, this determined dreamer educated himself in the Afghan refugee camps of Pakistan. He returned to Kabul after the Taliban's fall and created a school that taught civic education, along with human rights and female empowerment.

It is amazing enough that this slight, quiet Afghan was able to absorb humanistic values from his own reading. But what is even more impressive is how Royesh - a member of the repressed Hazara Shiite minority - won over (often illiterate) parents in the dusty Kabul slum of Dasht e-Barchi.

The odds were stacked against him. Hazaras are an Asiatic sect descended in legend from a unit of one thousand troops left behind after the invasion of Ghengis Khan (thus the book's title). They have long been disdained by Afghanistan's majority Pashtuns.

But, in fact, many Hazaras were so eager to educate their children that they helped Royesh build his school, room by room, floor by floor. When I visited in 2009, I watched students wade through mud to sit in cold classrooms bare of any amenities, yet they came prepared and debated noisily with teachers.

Stern, a native Philadelphian, got to know Royesh when he spent two years in Kabul as a freelance journalist after graduating from college. On his return to Philadelphia, he headed a video project at the National Constitution Center that matched Marefat students with counterparts here to explore the meaning of freedom to minority groups. In 2010, Royesh and some of the students were invited by the center to show their videos in Philly.

Returning to Kabul in 2013, Stern watched Royesh struggle to protect the school and its pupils. When girl students boldly demonstrated against a draft law proposed by Shiite clerics that would have sharply constricted Shiite women's rights, they were attacked violently.

The government forced Royesh to stop coed education (he built a separate building for girls, but retained coed extracurricular activities) and to drop civic education courses (he continued them by radio). Raising funds is a struggle, but he keeps the school afloat on tuition payments.

With President Obama initially determined to withdraw all U.S. troops by the end of 2014, Royesh constantly worried whether he was educating his students, especially girls, for disappointment. He also worried what would happen to them after the Americans left.

It was these fears that dogged Stern as he did his research. The Taliban has specifically targeted Hazaras, as has ISIS. Fearful of the future, and worried about the economy, a trickle of Marefat students has joined the global migrant exodus.

Stern said, "I wrote the book to ask this question: Are these students better off for having had the opportunity to think critically, even if it might be gone tomorrow?" He was also haunted by the 1975 image of Vietnamese clinging to the last U.S. helicopter evacuating Saigon. He didn't want the Marefat students to be the people on the roof.

Given Taliban advances, Obama has now decided to keep about 9,800 U.S. forces in Afghanistan through 2016, and 5,500 after he leaves office. Royesh told me by phone that this is important. "The mere presence of . . . U.S. forces is a psychological help for the Afghan people," he says, "because it shows them they are not abandoned to ISIS. It shows them the international community has eyes on Afghanistan."

Does he worry that, having been taught their rights, his students will be crushed when they try to exercise them? "The challenge for me," he said, "is to empower them with a new vision, but not to detach them from reality."

Marefat has become internationally known, but has not been embraced by Afghan educators outside the Hazara community. Royesh contemplated entering politics - working with President Ashraf Ghani before his election - but has soured on the idea.

Still, Teacher Royesh, as he is known, believes the spread of the Marefat mind-set is possible. But it will require intellectuals in other communities to promote the concept of citizenship. "It is a question of will," he insists. "Marefat is a beacon." Royesh's students - including adult women learning literacy - continue to soldier on, winning scholarships to Afghan and foreign universities. Of Gen. Allen's two orphans, Mustafa is studying in Turkey and Somaya in Kyrgyzstan.

Stern's book offers a vision of what is still possible in Kabul, and the obstacles that make it so improbable. If Marefat's story moves you, you can donate to the school at www.bamyanfoundation.org.