He's lived in Pakistan for more than 60 years – for the last 20 running one of its top schools. But he still swears by Quaker Oats and Lipton's tea for breakfast . . .

Much has occurred, and much has changed, since Geoffrey Langlands, a young maths teacher-turned-army commando, landed on the shores of British India on a troop carrier in 1944. Since then the intrepid Englishman has lived a life of algebra and adventure. He has scraped through several wars, been kidnapped in Waziristan, educated world-famous cricketers, and taken tea with princesses, several prime ministers and a ruthless dictator.

Some things, however, never change. Every morning the retired major, who turns 92 in a few months, rises at dawn in his cottage in Chitral, in the upper reaches of the Hindu Kush mountains in Pakistan's North West Frontier province. He puts on a blazer, tie and polished shoes. Then he sits down to breakfast served by his loyal servant, Sufi. It is always the same: porridge ("Quaker Oats, of course"), a poached egg (the poacher bought from Selfridges) and two cups of Lipton tea. He leafs through a newspaper, which has arrived via the valley's irregular plane service and is a few days old. Then it is out of the door, through the gate and up a winding hill to the school he founded and to which he has dedicated the last 20 years of his life.

The Langlands school and college (motto: "There is always room for improvement") is Chitral's finest school. It has 900 pupils aged between four and 18, more than a third of them girls, and a record of academic excellence. The best students have gone on to scholarships in Lahore, doctorates in Australia and exchange programmes in America. At between £3 and £6 a month, fees are low, even by local standards.

"Major Langlands is a living legend," says Motasim Billah Shah, the district coordination officer or top government official, in Chitral. "He has made an extraordinary contribution, a portrait of dedication. What he has been assigned by Allah almighty, he has done with all his energies."

Now, however, those energies are ebbing. Last year he had to be rushed by air to Peshawar after a minor stroke. He struggles to remember names, and every winter – Chitral is snow-bound for four months of the year – is more testing than the last. Longevity has brought a touch of loneliness: last year his loyal servant of 28 years, Muhammad Ali, died. "We used to argue about which one of us was older," Langlands says wistfully. "His one aim in life was to look after me. He was the perfect servant."

Finally, Langlands is contemplating retirement. But there is a problem: no replacement has been found, and disagreements abound. Meanwhile the school is losing money. For the people of Chitral this raises a troubling question: when the English major goes, will his fine school survive him?

The senior school is perched on a grassy plateau outside Chitral with a stunning view – vertiginous slopes and swaying fields of wheat on one side; the white-capped Terech Mir mountain, soaring to 7,700 metres, on the other. In the dimly lit principal's office, Langlands sinks into a large chair. He is a frail but authoritative figure, with cropped silver hair sweeping across a freckled forehead and keen blue eyes that gleam like lapis lazuli.

Chitral, with its isolated mountain culture, has largely escaped the turmoil that has engulfed the rest of the frontier province. A couple of weeks earlier, Langlands tells me, he got a call: the Taliban had kidnapped 80 secondary students from Razmak cadet college in North Waziristan, deep inside the lawless tribal belt. (All were later released.) Langlands had some advice to offer on two counts – he ran the college in the 1980s, and was also kidnapped.

"One of the tribal leaders had just lost an election," he recalls with a chuckle. "They thought that if I was taken, the president might reverse the result." The kidnappers weren't bad sorts: as they traipsed across the mountains towards a lonely cabin, they insisted on a souvenir photo. "They lined up with their Kalashnikovs; then they wanted one with me in it." Later they invited Langlands to join them for target practice, handing him a gun. "It didn't seem to occur to them I could turn on them, although I would have had to kill 16 of them," he says. After six days, a group of tribal elders sprung him free. The election result stood.

Days later Langlands was invited to lunch with General Zia ul-Haq, Pakistan's military ruler, in Peshawar. "He wanted to send me back to England," he says. "But I wanted to get back to Razmak as quickly as possible." Then again, going home has never been on his agenda.

Orphaned at the age of 12, Langlands was sent to India after taking part in the disastrous raid on Dieppe, when his commando unit captured a German heavy gun. In 1947 he found himself stranded on a train in no man's land, during the bloody partition of Pakistan and India, trying to prevent the Hindu troops under his command from being butchered. But in the end he preferred the Muslims, and plumped to stay in Pakistan to train the fledgling army. In 1954 he returned to his first love – mathematics – when the army chief, General Ayub Khan, arranged a job at Lahore's prestigious Aitchison College, where the British had educated the sons of India's tribal royalty. Ayub went on to become Pakistan's first military ruler, and Langlands stayed for 25 years, teaching upper-crust young Pakistanis destined to lead in business, politics and the army. And Imran Khan.

"Oh yes, he owes me quite a lot," he says, betraying a shy smile. "Everyone knew he was going to be an outstanding sportsman but I told him that if he wanted to be a leader, he would have to do his lessons." What does he think of Khan's reincarnation as a politician? (Khan has courted controversy by siding with pro-Taliban religious conservatives.) "The less I say the better," he says.

Langlands is well connected, to say the least. Down the years he has met President Pervez Musharraf, Benazir Bhutto, Nawaz Sharif and numerous backroom power brokers – usually with a view to extracting money for his schools. (Three years ago he persuaded Musharraf to give 50m rupees/£385,000), which forms the bulk of an interest-bearing fund that is meant to keep the school afloat, but doesn't.) Their photos adorn the mantelpiece of his home, a run-down former bank manager's bungalow threatened by a creeping tide of dust-smeared books. One photo shows a youthful Princess Diana, who visited Chitral in the early 90s. "So fresh and simple," he says.

In return, Langlands has a fierce loyalty to Pakistan. In the 1965 war with India he raised a militia among the gardeners and cooks of Aitchison. It didn't last long – when an Indian plane zoomed overhead "they hid under the banyan trees". He never married, he says, because "whether I found an English or a Pakistani lady, their first question would be when would we go back to England. No. I decided my career was in Pakistan." But for all that, he never requested a Pakistani passport.

"Whatever my qualities are, they are my Britishness," he says. He is wary of modern development experts and addresses his staff in English rather than Urdu. In heated moments, such as disagreements with teachers, the old army officer shines through, with a barking voice and wagging finger. "He runs the school in quite an authoritative manner. You can see a bit of a dictator in him," says Siraj ul Mulk, a friend and school board member.

Yet there is no doubting his dedication. After 73 years of teaching Langlands pays himself £160 a month – not much, even in Pakistan. His twin brother, who lives in Blackpool, has visited just four times in six decades, most recently in 1992. Langlands cannot visit him until someone – most likely a former student – stumps up for the air fare. But his success is also his weakness. Everything in the school – from fund-raising to micro-management – revolves around the ageing major. The worry is that when he is gone, it will all fall apart. "A brilliant teacher but not a good manager," says Shah. "We have to develop a system where people come and go but the institution remains."

A popular notion in Chitral is to find a replacement "Britisher". They're not so plentiful these days, though. Langlands is bravely resisting retirement: "I shall remain as long as I am mentally and physically fit," he declares – but is quietly making preparations. His beloved Aitchison college has agreed to provide lodgings in the prep school boarding house. In the end, he predicts, the principal's job will fall into local hands – possibly a good thing – but he is still open to another "Britisher". Adventure-seeking retired principals, apply now.

Some help is already at hand. David Game, an educationalist based in Notting Hill, London, who runs two other schools in Pakistan, is considering investing in the Langlands school. First, though, he says he would like to know how it will be run, and by whom. "Even if we get another person," he says, "it's not going to be another Major Langlands, is it?"