WHEN Pakistan’s schools attract global attention, it is often as a backdrop to violence. In October 2012 a masked gunman from the Tehreek-e-Taliban Pakistan boarded a school bus and shot Malala Yousafzai in the head, neck and shoulder. Two years later, and six days after Ms Yousafzai received the Nobel peace prize, terrorists from the same umbrella group killed 141 people, nearly all pupils, at an army-run school in Peshawar, one of the deadliest attacks on a school in any country. According to the Global Terrorism Database kept by the University of Maryland, 867 educational institutions were attacked by Islamists between 2007 and 2015, often because these places had the temerity to teach science—or worse, educate girls.

Such attacks have added to problems that schools in Pakistan, the world’s sixth-most-populous country, share with those in other poor states—irrelevant curriculums, high rates of dropout as children (especially girls) get older, and woeful teaching. Yet the spectre of violence may have obscured another development: the emergence of Pakistan as perhaps the world’s largest laboratory for education reform (see article).

Pakistan has long been home to a flourishing market of low-cost private schools, as parents have given up on a dysfunctional state sector and opted instead to pay for a better alternative. In the province of Punjab alone the number of these schools has risen from 32,000 in 1990 to 60,000 by 2016. (England has just 24,000 schools, albeit much bigger ones.)

More recently, Pakistani policymakers have begun to use these private schools to provide state education. Today Pakistan has one of the largest school-voucher schemes in the world. It has outsourced the running of more government-funded schools than any other developing country. By the end of this year Punjab aims to have placed 10,000 public schools—about the number in all of California—in the hands of entrepreneurs or charities. Although other provinces cannot match the scope and pace of reforms in Punjab, which is home to 53% of Pakistanis, Sindh and Khyber Pakhtunkhwa are implementing some similar changes on a smaller scale.

The results are promising—and they hold lessons for reformers in other countries. One is that “public-private partnerships” can improve children’s results while costing the state less than running schools itself. A paper published in August by the World Bank found that a scheme to subsidise local entrepreneurs to open schools in 199 villages increased enrolment of six- to ten-year-olds by 30 percentage points and boosted test scores. Better schools also led parents to encourage their sons to become doctors not security guards, and their daughters to become teachers rather than housewives.

Other new research suggests that policymakers can also take simple steps to fix failures in the market for low-cost private schools. For example, providing better information for parents through standardised report cards, and making it easier for entrepreneurs to obtain loans to expand schools, have both been found to lead to a higher quality of education.

Another, related lesson is that simply spending more public money is not going to transform classrooms in poor countries. The bulk of spending on public education goes on teachers’ salaries, and if they cannot teach, the money is wasted. A revealing recent study looked at what happened between 2003 and 2007, when Punjab hired teachers on temporary contracts at 35% less pay. It found that the lower wages had no discernible impact on how well teachers taught.

Such results reflect what happens when teachers are hired corruptly, rather than for their teaching skills. Yet the final and most important lesson from Pakistan is that politicians can break the link between political patronage and the classroom. Under Shahbaz Sharif, Punjab’s chief minister, the province has hired new teachers on merit, not an official’s say-so. It uses data on enrolment and test scores to hold local officials to account at regular high-stakes meetings.

Must try harder

Shifting from “the politics of patronage” to “the politics of performance”, in the words of Sir Michael Barber, a former adviser to the British government who now works with the Punjabis, would transform public services in poor countries. Pakistan’s reforms have a long way to go. But they already have many lessons to teach the world.