“I felt hurt on opening my wardrobe and seeing my uniform, school bag and geometry box,” Malala Yousafzai wrote in a diary she kept in the Swat Valley in 2009. “Boys’ schools are opening tomorrow. But the Taliban have banned girls’ education.”

Today, as the Pakistani heroine, now 14, fights for her life in a British hospital, nothing less than the fate of modernity in Pakistan hangs in the balance.

Malala and her devoted father, an educator who ran afoul of the masters of the Taliban, knew the risks, but would not be deterred. The masked assailants, who asked for her by name on a school bus and shot her at point-blank range, came out of a culture of darkness that has wrecked the dreams of those who want Pakistan to be a normal country at peace with itself.

It is hard to believe now that the founding dream of Pakistan, born out of the partition of British India in 1947, was a secular one. The founder of this oddest of nations, Mohammad Ali Jinnah, was a Bombay barrister who was a firm believer in British law and Indian nationalism. He had married his second wife outside the Islamic faith and had wanted nothing to do with the Mughal culture of North India that had yearned for a separate Muslim state.

It was one of modern nationalism’s great paradoxes that this most assimilated and modern of men would be the one to lead his people to the promised land of Pakistan. The creation of this polity came at the very end of Jinnah’s life; the man who moved to Karachi, from his home in Bombay, was old and ravaged by tuberculosis and lung cancer.

Jinnah’s Journey

In the course of a century, Muslims had fallen behind their Hindu compatriots, who had taken an easier leap into the modern world. Jinnah would lead a despondent people into a state of their own.

Still, Jinnah insisted that his Pakistan would not be a Muslim state. “You are free, free to go to your temples; you are free to go to your mosques or to any other places of worship in this state of Pakistan,” he was to tell the Constituent Assembly of this new nation. “You may belong to any religion or caste and creed; that has nothing to do with the business of the state.”

Pakistan would know disappointment. It would alternate between corrupt civilian governments and military despots; it would taste bitter defeat in wars with India over Kashmir. There would be struggles among its principal nationalities: the Punjabis, the Baluchis, the Pashtuns and the Sindhis. Yet for the first three decades of statehood, Islam would be kept at bay.

The catastrophic change that settled upon Pakistan came with the Afghan jihad and the rule of the military despot Muhammad Zia ul-Haq. Zia was eager for a role in the anti-Soviet holy war, and he secured it. He would strike this strange alliance -- with the mullahs as a self-styled pious ruler and with the U.S. as a soldier in the Cold War. The jihad gave Pakistan a place among the nations, and an avalanche of guns and money. South Asian Islam had been open and tolerant, but by the time of Zia’s death in a mysterious plane crash in 1988, the armed mullahs, the freelance preachers and the militant soldiers of virtue were loose on the land.

A Karachi-born writer, Kamila Shamsie, summed it up well in an account of her childhood during those dangerous 1980s. “We lived in the Kalashnikov culture,” she wrote in a recent essay in the literary magazine Granta. “By the mid-eighties, Karachi, my city, a once-peaceful seaside metropolis, had turned into a battleground for criminal gangs, drug dealers, ethnic groups, religious sects, political parties -- all armed.”

Appeasing Mullahs

The frontier that separated Pakistan from Afghanistan, that famous Durand Line, was a hazy, meaningless line drawn on a map by colonial administrations. Tribes and warriors moved across it. The Afghan Taliban, forged in the “madrassas” and the refugee camps in Pakistan, were at once manipulated by Pakistan’s intelligence services and consequential players in the sordid national political game. The sophisticated urban culture of Lahore and Islamabad was now in a struggle against the primitive holy warriors and the culture of the tribal areas.

The ruling elites could never do it right; they appeased the radical mullahs, and cut deals with them in pursuit of narrow partisan interests. For the soldiers of darkness, the appetite grew with the eating. The valley of Swat, once a paradise and a stone’s throw from the capital, was ceded to the Taliban and was only retrieved by the army in 2009, after the barbarism of the Taliban shocked the country.

The man who gave the warrant for the attempted murder of Malala, Mullah Maulana Fazlullah (known as Radio Mullah for his incendiary broadcasts spewing misogyny and religious hatred) had been given a long leash. He had forced Pakistan’s rulers into humiliating concessions. By early 2009, he had struck into the district of Buner, a mere 60 miles from Islamabad.

The Oct. 9 attack on a school bus and the targeting of a teenager with a hunger for education were, to this primitive avenger, a religious duty that he had allocated to himself.

Malala gave her country a precious gift at such a terrible personal price. The obscurantists and the fence sitters, as well as the pundits who make anti-Americanism their diet and weapon of choice, can’t avoid the full meaning of what happened to this amazing child. This is their daughter in that hospital in Birmingham, the best of what they wanted for themselves when they braved it all, little more than six decades ago, and set out in quest of their own sovereign state.

(Fouad Ajami is a senior fellow at Stanford University’s Hoover Institution and the author of “The Syrian Rebellion.” The opinions expressed are his own.)

Read more opinion online from Bloomberg View. Subscribe to receive a daily e-mail highlighting new View editorials, columns and op-ed articles.

Today’s highlights: the editors on what the presidential candidates aren’t saying about coal power and on the right way to plug national security; Caroline Baum on five things the Republicans won’t tell you; Ezra Klein on Romney’s biggest problem; Jonathan Mahler on the decline and fall of the New York Yankees; Fouad Ajami on Malala and the history of Pakistan; Phil Zuckerman on why secular voters may be more powerful than you think.

To contact the writer of this article: Fouad Ajami at mjring@stanford.edu.

To contact the editor responsible for this article: Katy Roberts at kroberts29@bloomberg.net.