In Damian Barr’s polished and harrowing debut novel, two inextricably tangled South African tragedies unfold a century apart.

At the height of the second Boer war, in 1901, Sarah van der Watt is sent with her only child, six-year-old Fred, to a British concentration camp. Her husband has already left to fight for the Orange Free State, and before she and Fred are herded into a boxcar, she’s forced to watch soldiers slaughter their livestock and torch their home. The “Khakis” shovel innards down the well and send Sarah’s beloved collection of Dickens novels up in smoke: “stories taking wing”.

On arrival at Bloemfontein, the Van der Watts are housed in a tent resembling “the lung of an ailing sheep”. Despite the mocking civility of a camp choir and gardening club, it’s fighting off typhoid, malaria and starvation that fills their days, and devastation hangs over Sarah’s diary entries even before the flies start swarming.

More than 100 years later, 16-year-old Willem is dropped off at the gates of a superficially quite different sort of place, the New Dawn Safari Training Camp. A quiet boy who loves Harry Potter and Britney Spears (he’s even named his pug after her), Willem is there to be toughened up at the insistence of his ineffectual mother and her brute of a boyfriend, who’s nostalgic for the days before his country became the Rainbow Nation. The fear is that Willem is “sensitive”, or worse yet, a “moffie”, and New Dawn promises to “make men out of boys”. Again, calamity seems inevitable – it’s there in the very air that, thanks to a nearby steelworks, tastes of “old torch batteries licked on a dare”.

These distinct narratives are equally convincing. Both have been extensively researched (the contemporary strand is inspired by the 2011 death of 15-year-old Raymond Buys, the book’s dedicatee, at a camp similar to New Dawn), yet that learning is worn lightly, and Barr shifts between two very different tones with a light touch, maintaining a subtle emotional intelligence throughout.

There are moments of almost shocking drollery, too. For instance, running out of space in her diary, Sarah notes: “Not many pages left. I didn’t expect so much to happen.” Meanwhile, the harsh poetry of the land anchors the text, its red earth stretching out beneath starlit stillness, unchanging from generation to generation.

Barr’s award-winning memoir, Maggie and Me, described what it was like to grow up queer in working-class Scotland in the 1980s. Homophobic violence overshadows the brutal closing section of You Will Be Safe Here, but it’s the connections between then and now that make it so devastating. They are revealed only gradually, at first through coincidence and then intimated causality, falling nauseatingly into place via the glimpse of a toy gun carved from cherry wood.

In an author’s note, Barr states that British colonial savagery helped prepare the ground for apartheid. To its great credit, the novel itself shades even this neat assertion with grey. By its end, so many instinctive responses will have been upturned that the reader will be left with just two certainties: that the circularity of man’s cruelty to his fellow human beings is endless, and that only kindness is stronger.

• You Will Be Safe Here by Damian Barr is published by Bloomsbury (£16.99). To order a copy go to guardianbookshop.com or call 0330 333 6846. Free UK p&p over £15, online orders only. Phone orders min p&p of £1.99