When Richard Shepherd was diagnosed with post-traumatic stress disorder in 2016, the mental health nurse told him he was really worried. “Most people say they’re going to commit suicide,” the nurse said, “but you actually know what to do.”

Shepherd’s career as one of the UK’s most distinguished forensic pathologists saw him involved in disasters from the Hungerford shootings to the Bali bombings, and in high-profile cases from Harold Shipman to Stephen Lawrence. His daily life was made up of blood-spattered corpses and formalin-soaked dissections, anguished relatives and scornful barristers. But it wasn’t a particular incident that left him immobilised by dread, struggling with sleep and plagued by panic attacks. Instead, it was the gradual accumulation of stress from 30 years confronting violence and the grave, the steady buildup of emotional damage from putting 23,000 dead bodies under the knife.

“You don’t notice it,” Shepherd says, “because you think you’re good enough to do it without giving in. But, actually, it’s like little fish – nibble, nibble nibble – such tiny pieces go that you don’t notice the individual bites. And yet, when you look back, you realise it is having an effect.”

When you arrive on the scene of a violent crime, he continues, you have to switch off from the fact that something terrible has happened that will utterly change the lives of the people involved and those around them. “The ripples on the pond are huge,” he says. “But I have to shut that off and look at where are the stab wounds, where are the splashes of blood – purely scientific, medical things. When you come out of it, you can say, ‘God, that’s just awful,’ and you do. But at that moment emotions have just got to go.”

Armed police outside Michael Ryan’s house in Hungerford in 1987. Photograph: Daily Mail/Rex/Shutterstock

Shepherd charts the rising cost of this battle for detachment in a memoir, Unnatural Causes, that puts the reader at his elbow as he wields the scalpel. Beneath the unresisting skin, he reveals an intricate and beautiful mechanism – the gall bladder the green of jungle foliage, the brain the silver-grey of darting fish, the liver the sharp red-brown of a freshly ploughed field – in which the expert can read the marks of innocence or guilt. From the eerie quiet of Hungerford High Street after the murder of 16 people to the trail of blood leading up to the bedroom of an anonymous terraced house, Shepherd conjures up the uncanny traces of sudden death, the grisly remnants he tried to put out of mind for decades.

This strategy of repression has deep roots. Shepherd’s mother succumbed to the heart condition that had dogged her for years in 1962, when he was only nine. As well as doing all the shopping and cooking, Shepherd says his father unlocked stores of kindness and affection that were often untapped in men of his generation. But when a friend brought a copy of Simpson’s Forensic Medicine into school, Shepherd found himself fascinated by the gallery of stranglings, knifings, shootings and electrocutions the textbook contained. Between those tatty red covers, the worst that could happen – the terrible thing that had, in fact, already happened – was laid out, anatomised and dissected. The tragedy that had changed Shepherd’s own life could be viewed through the dispassionate eyes of the great Simpson, could be analysed, understood and, perhaps, contained. There he found an enduring passion and an approach that would guide him through his career.

It was a stance that served him well early on, Shepherd says, “because I could detach from the things other people found harder – going to medical school, doing the anatomy dissections. It actually gave me a benefit.”

Facing challenges such as these, the moments that can determine the future course of your life, is like riding in the Grand National, he continues, and approaching Becher’s Brook. “It’s big and it’s awful and you’re hammering towards it and you know you can’t stop. When you go over it, you look back and go: ‘That wasn’t too bad.’” After qualifying as a doctor in 1977 and conducting his first postmortem three years later, it was all too easy to think the psychological load that made these obstacles so daunting had been left behind. “All the emotions involved in postmortems are gone because I’ve done the first one.” He shakes his head. “Wrong.”

In 1989, 51 people died when the Marchioness struck a dredger on the Thames. Photograph: Graham Turner/Guardian

While he prided himself on his ability to switch between mortuary and home, from objective investigator to loving husband and father, his marriage was beginning to show signs of strain, eventually collapsing in 2007. Although his wife would ask him to “show some emotion”, he says, “I hadn’t realised that it was so tightly screwed down. I was blocking the emotion that was bad, but I was also blocking the emotion that was good.”

Cocooned in the embrace of his professional detachment, Shepherd advanced from one case to another, first under the wing of the flamboyant Iain West in Guy’s hospital at London Bridge and then in his own department at St George’s Tooting. Alongside the large-scale horror of disasters such as the Clapham rail crash in 1988 and the sinking of the Marchioness the following year, a series of deaths in custody saw Shepherd pushing for police officers to receive proper training in methods of restraint, while a string of home-grown experiments with the Sunday roast made him something of a specialist in the more intimate tragedy of knife crime.

When a body is laid out on the mortuary slab, Shepherd says, it is often difficult to tell whether an individual death will have a wider impact. Take the example of Stephen Lawrence: “I hate to say this but, pathologically, it was simple. As with many stab wounds, if it had been a millimetre one way or the other, he could so easily just have ended up in hospital for a couple of days. But he didn’t. What made it complicated was the police investigation – or the lack of it.”

The cases that turn out to be important are the ones where relatives refuse to take no for an answer, the ones that “show the glitches in society”. “Society is made up of tectonic plates,” Shepherd says. “Every now and then they have to move to keep society functioning, to take the pressures out of it.”

Harold Shipman, the GP who killed more than 200 of his patients. Photograph: PA

One of the shifts he has witnessed first-hand is the decline of respect for authority figures. Just as cases such as Stephen Lawrence have reduced our confidence in the police, our trust in doctors has been eroded by the revelation that a GP such as Harold Shipman could kill more than 200 of his patients. It’s quite right that medical professionals should be challenged, Shepherd says, but “when you’re omnipotent and you think you’re omnipotent and everyone else thinks you’re omnipotent, life is a hell of a lot easier”.

As doctors have gradually lost their veneer of perfection, appearances in court have become more of a trial, even for experienced forensic pathologists. “We do all this incredible work, put together these reports,” Shepherd says. “Then we stand up in court and some barrister has a go at you and says: ‘You’re talking rubbish.’” When you have given your heart and soul to a case and someone goes on the attack, “that can be very painful”.

It is hard enough to imagine this robust, energetic figure wilting under a barrister’s cross-examination, let alone being pursued to the brink of suicide by images of decaying corpses. Two years on from his diagnosis of PTSD, after both counselling and medication, Shepherd’s enthusiasm for the mysteries of the human body has returned, his love of the discipline he has made his life restored.

“I’ve been very lucky,” he says, “but there is this sting in the tail, it’s not been absolutely plain sailing. I am human, after all – cutting up 23,000 dead bodies is not a normal thing to do. How can you do this? You have to have a fundamental belief that, in the end, you are doing some good.”

As a qualified, professional man who thought he was able to cope with anything that life could throw at him, Shepherd says it was important to declare he had reached a point of crisis, that “this did happen and it was bloody awful but, with treatment, I’m out the other side”. For anyone with similar concerns, his advice is to “get help, get treatment and you will go back to a normal life”. He remarried in 2008 and, after retiring from the Home Office’s list of forensic pathologists in 2017, he continues to take on cases referred by teams for the defence.

His experience of PTSD was important, he says, but it is not the defining issue of his life. And that upbeat assessment owes nothing to the habits of avoidance and repression that stretch back almost 60 years. “Having gone through that, it has cracked open the carapace. It’s out and I’ve learned, I hope,” he raps his knuckles on the wooden tabletop, “how to deal with it.”

Unnatural Causes, by Dr Richard Shepherd, is published by Michael Joseph.