A few months after the earthquake hit Pakistan in 2005, I toured the devastated town of Batal in the north where a community owned primary school had been rebuilt with donations from overseas. Inside the only functioning classroom located on a hillside, girls and boys of varying ages were seated together behind tiny desks. The boys all wanted to grow up to be doctors, the girls all wanted to be teachers.

A community elder, Ghulam Jan, who had donated his land for the building of the school, told me: "Our time is over ... We want our children to study so that they can become something when they grow up."

This plea has been echoed by communities in struggling coastal towns in the south to remote mountain valleys in the north of Pakistan. Wherever I have gone to cover stories from sea intrusion to glacier melt, I have heard the same demand – we want schools for our children; we want them to have better lives. But the community in Batal is just one of the lucky few to have a functioning primary school for its children.

For more than 60 years now, the government of Pakistan has failed abysmally to provide its people with primary education; a basic right enshrined in article 25A of its constitution which assigns the state with providing free and compulsory education to all children aged between five and 16 years. A recent report written by the Pakistan Education Task Force, a non-partisan body that includes representatives from the federal and provincial governments and NGOs, paints a dismal picture of the state of education in the world's sixth most populous country.

The report, Education Emergency Pakistan, was published in March, before David Cameron's recent visit to Pakistan where he announced £650m in aid for education. The report says that about 10% of the world's primary school-age children who do not attend school live in Pakistan. In the global ranking of out-of-school children, Pakistan is in second place.

"Pakistan is crippled by an education emergency that threatens tens of millions of children," the report says. "The economic impact of the education emergency is as expensive as a flood every year," according to the report. Last summer's extensive floods caused about $10bn worth of damage, including destroying or damaging a thousand schools.

To make matters worse, the Pakistani government is yet to announce its reconstruction strategy. The delay has meant that urgent rebuilding and recovery work has barely started eight months after the flooding, according to Oxfam.

Given such a bleak situation, any money that will go towards education is more than welcome, and Cameron's promise of aid, which is to be spent on 4m primary school places and 90,000 teachers will go a long way in improving the situation, provided the money is channelled through trustworthy organisations such as the community based organisation that built the school in Batal. At the moment, however, it appears that the funds are to be allocated to the provincial governments where the fear is the money might just slip through the cracks of poor governance.

The report also notes the striking gender disparity in schooling in Pakistan. Fewer than half of Pakistani women have had any formal education. The figure is even worse in rural areas, where just one in three women has ever attended school. For most families, the archaic thinking is that girls must marry and look after their husbands and in-laws, so why bother wasting precious money on their education? According to the report, there is "zero chance" that Pakistan will reach the millennium development goal for education by 2015.

"This is not just another emergency declared, this is a matter of Pakistan's survival," said Shenaz Wazir Ali, a member of the national assembly and co-chair of the Education Task Force, who also served as the head of the Higher Education Commission of Pakistan.

The government has allocated less than 1.5% of the country's GDP for education. Cameron made it a point to criticise Islamabad for spending only 1.5% of its national income on education and asked it to improve its tax revenues.

Perhaps more important, the Pakistani government has to get its priorities right. Pakistan spends almost all its resources on defence and state security, leaving aside little for education. If it really wants improve its long-term security it should be pouring money into education, which – as David Cameron pointed out – is actually the best antidote to terror.