Growing up in Bradford in northern England, Samayya Afzal’s favourite subject was history, even if every year at school seemed to involve studying the first or second world wars. She noticed that people like her family – immigrants from Pakistan – were missing from lessons about trenches and D-Day, Churchill and Digging for Victory. She knew that her great-grandfather had fought for Pakistan against India, in the bloody aftermath of Independence. Then, last year, she asked to see his medals. Her grandmother handed over a surprise: British decorations, including an Indian Army medal and a pair of Burma Stars, recording service for the British Empire against Japan. It was a complicated moment. Afzal’s earliest political memories involve the invasion of Iraq in 2003, and her instincts err towards pacifism.

Early in October she travelled to the National Archives in Kew, along with 13 other descendants of men who fought in the world wars for the Raj. The gathering had a serious purpose: to uncover family histories that might illuminate the service of 400,000 Muslims who fought for British India in the first world war, with help from a professional genealogist.

It was hosted by “Unknown and Untold”, a project that seeks to teach that history to Muslim and non-Muslim youths in towns with racial and religious tensions like Bradford and Leeds. A collaboration between British Future, a centrist think-tank, and New Horizons for British Islam, a charity that aims to “promote a pluralistic, open understanding of Islam”, the project is designed to remind forgetful Britons that multi-racial, multi-faith armies fought to preserve their freedoms. In the words of Laura Dias, one of its organisers, “The army in 1914 looked a lot more like the Britain of today than you might realise.”

In exquisitely British style, the gathering began with much offering of seats and discussion of bus routes, self-deprecation and the shushing of children (the Ahmed family of Stockton-on-Tees brought three generations). Rabia Mirza, a young woman from Derby, said she had come “to see if my grandmother was talking rubbish” about her family’s war service. The Ahmed family patriarch, Riaz, came bearing fragile memories of his late father and uncles recalling service in France, Burma and Hong Kong, spanning both world wars. His only solid reference point was his father’s story about how he saw a British pilot crash his plane after trying to fly under Attock Bridge in Kashmir.

A faintly apologetic air hung around the group’s smallest contingent: grandchildren of white British officers, clutching battered photograph albums, regimental histories and reams of documents about embarrassingly well-recorded ancestors. One of them – me – brought his own nervous hope: to discover whether my grandfather, an Indian Army officer who fought in both world wars, really was evacuated at Dunkirk with his Indian troops, as I had grown up hearing.

After two days, discoveries abounded. Afzal’s great-grandfather was traced to one of several motorised transport companies sent to Burma. Mirza found her grandfather, who reached the rank of subedar, commanding Indian troops in the Royal Bombay Sappers and Miners. The Ahmeds found RAF records of that plane crash at Attock Bridge. All planned to keep researching.

My luck felt faintly indecent. Records brought to life the Mesopotamian campaign my grandfather saw in 1917. A photograph of moustachioed white British officers taken in Abbottabad in 1926 featured both my grandfather and the grandfather of another member of the group – though she had been a perfect stranger on arrival at Kew. I opened the official war diary of an Indian Army company in France in May 1940, and found my grandfather had written it. Laconic while his men and their transport mules dodged enemy aircraft and prowling German tanks, his phlegm wavered only on reaching Dunkirk, which he recorded as “in ruins, burning furiously and being bombed incessantly”. All his men escaped to Britain.

The gathering left Shaukat Ahmed, a cheerful 40-year-old builder, visibly moved. Growing up in Stockton, diversity “was all about economic migrants from India and Pakistan doing jobs people didn’t want to do”. He also recalled being told, “Go back to your own country.” Two days at Kew had taken him back past that story of immigration, to something at once more stirring and darker: the story of Empire. Ahmed had no idea that so many Muslims fought in the world wars, and sees value in teaching that shared history, so that maybe “our kids don’t have to feel as alienated as we did.”

There are risks to revisiting colonial history. The Empire was diverse but brutally unequal. Even the brief, benign gathering at Kew reawakened old divisions of rank and class. It is because British officers formed their own small world in India, and because they could ship home trunks laden with photographs and service records as the Raj ended, that their grandchildren could stage impromptu reunions seven decades later. Still the risks are surely worth taking. Generations of Muslims grew up feeling “absent” from British history, as one descendant put it. But they were there, as our grandfathers knew.