Martin Amis, typical of the current rash of instant experts on Islam, wrote recently in the Observer: "We may wonder how the Islamists feel when they compare India to Pakistan, one a burgeoning democratic superpower, the other barely distinguishable from a failed state."
Yet the reality on the ground in Pakistan is far more complex than the caricature imagined by the likes of Amis: under the urbane eye of Shaukat Aziz, formerly a vice-president of Citi bank and now Pervez Musharraf's prime minister, Pakistan is enjoying a construction and consumer boom, with growth approaching 8 per cent and the fastest-rising stock market in Asia. It also has better roads and airports, and more reliable electricity than in India. Flying in to Lahore or Islamabad from Delhi or Bombay, one feels immediately that one is in a less poverty-ridden country: there are fewer beggars on the roads, the new motorways and concrete mosques make it more closely resemble a dusty Gulf state than a former part of India, and the houses look more substantial.
There are, however, many areas where Pakistan is doing less well than India: most obviously, the country seems unable to support sustained democratic governance. It has an abysmal human-rights record, a long history of some of the worst governmental corruption in the world, and an increasingly violent Islamist problem.
Yet, despite these awesome difficulties, no problem in Pakistan casts such a long shadow over its future as the abject failure of the government to educate more than a fraction of its own people: at the moment a mere 1.8 per cent of Pakistan's GDP is spent on government schools. The statistics are dreadful: 15 per cent of these government schools are without a proper building; 52 per cent without a boundary wall; 40 per cent without water; 71 per cent without electricity. There is frequent absenteeism of teachers; indeed, many of these schools are empty ruins or exist only on paper.
This was graphically confirmed by a survey conducted two years ago by the former Pakistan cricket captain-turned-politician Imran Khan in his own constituency of Mianwali. His research showed that 20 per cent of government schools supposed to be functioning in his constituency did not exist at all, a quarter had no teachers and 70 per cent were closed. No school had more than half of the teachers it was meant to have. Of those that were just about functioning, many had children of all grades crammed into a single room, often sitting on the floor. There is little wonder that Pakistan ranks among the very lowest countries in the UNDP's world human development index.
This education gap is the most striking way in which Pakistan lags behind its neighbour: in India 65 per cent of the population is literate, and the number rises annually. Only last year, the Indian education system received a substantial boost from state funds; and there is, in any case, a tradition among Hindus of making terrific sacrifices in order to educate children. But in Pakistan the literacy figure is under half (it is currently 49 per cent), and falling: instead of investing in education, Musharraf's military government is spending money on a cripplingly expensive fleet of American F-16s for its air force. As a result, 83 million adults of 15 years and above - out of a population of 160 million - are illiterate. Among women the problem is worse still: 65 per cent of all female adults are illiterate. As the population rockets, the problem will get worse: only half the children in Pakistan will have access to any formal education, and the remaining half will never see the inside of a school. Of those who do enrol, half will drop out in the course of their primary education.
The virtual collapse of government schooling has meant that many of the poorest people who wish to enhance their children's hope of advancing themselves have no option but to place them in the madrasa system, where they are guaranteed an ultra-conservative and outdated but none the less free education, often subsidised by religious endowments provided by the Wahhabi Saudis.
Altogether there are now an estimated 800,000 to one million students enrolled in Pakistan's madrasas: an entire free Islamic education system existing parallel to the increasingly moribund state sector. Though the link between the madrasas and al-Qaeda is often exaggerated - the overwhelming majority of the sophisticated international Salafi jihadis associated with Osama Bin Laden's group are middle-class and were well educated at western-style colleges - it is true that madrasa students have been closely involved in both the rise of the Taliban and the growth of sectarian violence within Pakistan and Afghanistan; it is also true that the education provided by many madrasas is often wholly inadequate to prepare or equip children for modern life in a civil society.
Education within reach
There is, however, one bright glimmer of hope in this depressingly dark situation. In 1995, a group of Karachi-based Pakistani businessmen founded a new charity called The Citizens Foundation, or TCF, with the simple aim of taking Pakistan's children off the streets and providing them with a quality, secular education at heavily subsidised prices. Since then the charity has grown at the most remarkable rate: TCF now has 311 purpose-built schools located in Pakistan's most miserable slums and most underdeveloped rural areas, and a new one opens every single week. Each morning, around 40,000 boys and girls enter the gates of a TCF school somewhere in Pakistan.
The TCF schools I have visited are remarkable: in contrast to the government-run primaries, which usually resemble little more than cattle pens, TCF schools are beautifully planned two-storey structures built in brick, with attractive courtyards and verandas. Each has six classrooms, a library, an art room and washrooms with running water; the secondary schools have, in addition, science and computer rooms. The quality of teaching is surprisingly high, and TCF has its own purpose-built teacher-training institute where the staff - entirely made up of women, in order to encourage parents to enrol their girls - receive a thorough grounding in education. Since it was opened in 1997, more than 2,400 trained teachers have emerged from the institute and taken up positions in TCF schools.
The quality of teaching provided to the children in many cases equals that of Pakistan's smartest private schools; yet the kids who enrol are from the very poorest and most deprived families. Although all children have to pay fees of a minimum of ten Pakistani rupees a month, TCF's adjustable fee structure gives the poorest children access to an education, uniforms and school books at heavily subsidised rates - up to 95 per cent of fees - putting a top-quality edu cation within the reach of the poor for the first time. Already the first batch of graduates from the TCF system has been winning scholarships to Pakistan's leading colleges.
It costs just £10 a month to educate a child at a TCF school; £6,000 will keep an entire school running for a year. TCF is probably the most dynamic, impressive and well-run south Asian charity I have come across in 20 years of writing about the subcontinent. Yet, given Pakistan's now central geopolitical role, and the huge stake that the west has in seeing Pakistan surviving as a moderate and potentially democratic country, it is an NGO that we need to support almost as much out of self-interest as charity.
Donations can be sent to: The Friends of the Citizens Foundation, 9 Camden Road, London E11 2JP. The TCF website is http://www.thecitizensfoundation.org 
William Dalrymple will be giving a fundraising lecture for TCF on his new book, "The Last Mughal", at the Royal Geographical Society, 1 Kensington Gore, London SW7, on Thursday 17 May. Tickets cost £15 each and are available online at http://www.ftcf.org.uk