KABUL, Afghanistan  For much of this country’s history, the Hazara were typically servants, cleaners, porters and little else, a largely Shiite minority sidelined for generations, and in some instances massacred, by Pashtun rulers.

But increasingly they are people like Mustafa, a teenager who has traveled a rough road but whose future now looks as bright as any in this war-ravaged country. His course reflects the collective effort of the Hazara, who make up 10 to 15 percent of the population, to remake their circumstances so swiftly that by some measures they are beginning to overtake other groups.

Like many Hazaras of his generation, Mustafa, now 16, fled Afghanistan with his family in the mid-1990s. They settled in Quetta, Pakistan, living with other Hazara refugees outside the Taliban’s reach and getting a taste of opportunities long out of their grasp.

After the 2001 American invasion, his family returned, not to their home in impoverished Daykondi Province, but to Kabul, where his uneducated parents thought Mustafa and his siblings would get better schooling. “There was no opportunity for studying in Daykondi,” he said.