Malala Yousafzai speaks before the United Nations Youth Assembly in New York, inspiring the world with her call for action on education. Photograph: Stan Honda/AFP/Getty Images

Last October, the Taliban thought they had solved a problem. When one of its gunmen shot a 15-year-old girl in the head for publicly opposing a ban on girls' schooling, it looked as though they had silenced a source of dissent. Instead, their intended victim has emerged a powerful voice for education. Speaking at the UN two weeks ago, Malala Yousafzai capitivated a global audience when she called on children worldwide to demand universal primary education and for governments to deliver free schooling.

"I raise up my voice so that those without a voice can be heard," she said. Her speech was a passionate call to action. But it was also a stark reminder of the failure of governments to deliver on their promise to get all of the world's children into school by 2015. And no government has failed more comprehensively than that of Pakistan.

Pakistan is a case study for the consequences of political neglect of education. One in four of its primary school-age children – 5 million in total – is out of school. Around half of those who get into school drop out before the end of grade 3. Not that getting through school is any guarantee of learning. After three years of primary education, only one-third of children are able correctly to formulate a sentence containing the word "school" or add a two-digit sum.

Behind this desperate picture are some of the world's starkest inequalities. Urban boys from the wealthiest 20% of households average 10 years of schooling. By contrast, rural girls from poor households get just one year.

While the western media has locked on to the threat posed by the Taliban, the problems are far deeper. Poverty, gender inequality and the shocking failure of Pakistan's political elite to invest in schooling are at the heart of the country's education emergency.

Barriers to equal opportunity start long before children enter school. More than 40% of under-fives in Pakistan have been stunted by malnutrition, with devastating consequences for their brain development. Around one in five households is living below the poverty line. Some 8 million of Pakistan's school-age children are spending their days not in school nurturing their minds, but working in brick kilns, sweatshops and fields.

Few countries invest less in education than Pakistan: successive governments have allocated around 2% of GDP to the education budget. Starved of public finance, most public schools charge fees, excluding many of the poorest children.

Many rural areas and urban slums lack any public schools and this gap has created a flourishing market for low-fee private providers.

One thing that Pakistan has not lacked is flamboyant advice from outsiders. Bestselling books have purported to show how communities in tribal areas can build schools "one stone at a time" without help from government. Sadly, it turned out that the evidence didn't support the claims.

Recently, Tony Blair's public service efficiency adviser, Sir Michael Barber, has been explaining to all and sundry that Pakistan's education crisis can be fixed by a renewed focus on "the science of delivery" – a technocratic approach currently in vogue at the World Bank.

The claims are documented in a recent book with a giveaway title – The Good News from Pakistan. In it Barber documents a series of reforms which, by his own account, he designed and led in the Punjab, Pakistan's most populous province, from 2010. He claims that the reforms – a mix of vouchers for low-fee private schools, more efficient administration and strengthened monitoring – put another 1.4 million children into school in less than three years.

The problem is that the data does not back the claims, as explained recently by Jishnu Das, a senior economist at the World Bank. The Punjab story is one of slow and steady progress, not a great leap forward. Aid from the UK has contributed. But the data chosen by Barber has the effect of exaggerating the increase in enrolment and ignoring the need for wider structural reforms beyond the education sector.

Measures that are needed include a far stronger focus on child malnutrition and a fair taxation system. To her credit, Justine Greening, the secretary of state for development, has called on Pakistan's government to double the share of GDP collected as tax revenue. When it comes to tax avoidance, wealthy Pakistanis make Google and Starbucks look like amateurs. The country collects just 8% of GDP in revenues thanks to loopholes designed by successive governments.

The stakes could hardly be higher. Pakistan has one of the world's youngest and fastest-growing populations in the world. Half of the country is under 20. If the education system equips the country's youth with the skills to drive the 7% economic growth needed to generate another 2-3 million jobs annually, Pakistan stands to reap a demographic dividend. Failure will see a growing stream of frustrated youth facing a future without hope in a country gripped by economic stagnation, with attendant threats to national security.

Two weeks ago, a 16-year-old school girl moved the world. Her ambition and tenacity in the face of adversity demonstrated that education can be an irresistible force for change. If her country's leaders follow her example, Pakistan's future will look very different.

• Kevin Watkins is executive director of the Overseas Development Institute

Sign up for the Guardian Today

Our editors' picks for the day's top news and commentary delivered to your inbox each morning.