Fifty years ago, in the early hours of Sunday 2 July, 1961, Ernest Hemingway, America's most celebrated writer and a titan of 20th-century letters, awoke in his house in the Sawtooth Mountains of Idaho, rose from his bed, taking care not to wake his wife Mary, unlocked the door of the storage room where he kept his firearms, and selected a double-barrelled shotgun with which he liked to shoot pigeons. He took it to the front of the house and, in the foyer, put the twin barrels against his forehead, reached down, pushed his thumb against the trigger and blew his brains out.

His death was timed at 7am. Witnesses who saw the body remarked that he had chosen from his wardrobe a favourite dressing gown that he called his "emperor's robe". They might have been reminded of the words of Shakespeare's Cleopatra, just before she applied the asp to her flesh: "Give me my robe. Put on my crown; I have immortal longings in me". His widow Mary told the media that it was an unfortunate accident, that Ernest had been cleaning one of his guns when it accidentally went off. The story was splashed on the front page of all American newspapers.

It took Mary Welsh Hemingway several months to admit that her husband's death was suicide; and it's taken nearly 50 years to piece together the reasons why this giant personality, this rumbustious man of action, this bullfighter, deep-sea fisherman, great white hunter, war hero, gunslinger and four-times-married, all-round tough guy, whom every red-blooded American male hero-worshipped, should do himself in. How could he? Why would he? Successive biographers – AE Hochtner, Carlos Baker, KS Lynn, AJ Monnier, Anthony Burgess – have chewed over the available facts, his restless travelling, his many amours, the peaks and troughs of his writing career. But eventually it took a psychiatrist from Houston, Texas, to hold up all the evidence to the light and announce his disturbing conclusions.

Download the new Independent Premium app Sharing the full story, not just the headlines

The idealised life of Ernest Hemingway, the one the writer himself wanted the world to buy, was simple: he was the perfect man, the perfect synthesis of brain and brawn. Driven by a thirst for adventure, he was a swashbuckling, hard-drinking pugilist who loved being in the thick of the action, whether in the front line of battle or within charging distance of a water buffalo. He also happened to be the finest writer around, disdaining the grandiose wordiness of Victorian prose for a clean, stripped-back simplicity, conveying emotion by what was not said as much as by what was. Wounded on the Italian front in the First World War, he was a handsome convalescent who fell in love with a pretty nurse and wrote A Farewell to Arms as a result. In the 1920s, he was at the forefront of American writers and artists who hung out in Paris, "being geniuses together". They included F Scott Fitzgerald, who (according to A Moveable Feast) once showed Hemingway his penis and confessed his worry that it was too small to satisfy his wife Zelda; Hemingway kindly reassured him it was OK.

In the 1930s, he went to Spain to fight for the republic against Franco and wrote For Whom the Bell Tolls, in which a brave American hero falls in love with a peasant guerrilla called Maria. In the Second World War, he was at the Normandy landings and the liberation of Paris. After the war he retired with his fourth wife to Cuba, where he fished for marlins and wrote The Old Man and the Sea, won the Nobel Prize, was lionised wherever he went – but was killed in an unfortunate firearm accident.

That's the official story. In the years after his death, however, the jigsaw pieces of a counter-life gradually began to emerge. His war record, for instance. Hemingway was only 18 when he signed up for the First World War – but it was as a non-combatant. He had a defective left eye, inherited from his mother, which kept him out of battle. He went to Italy to man the Red Cross canteens and evacuate the wounded. Helping a wounded man to safety one evening, he was shot in the leg and hospitalised in Milan, with three other patients and 18 nurses. Though his dalliance with Sister Agnew von Kurovsky was unconsummated, he fell in love with European culture and manners, swanned about in an Italian cloak, drank wine and affected a clipped delivery borrowed from a British officer, Eric Dorman-Smith.

In Paris, where he enjoyed a temporary idyll with his first wife Hadley and their baby John (or "Bumby"), Hemingway started to make his name as a writer – but also to display dangerous mood swings, irascibility, spite and a compulsion to turn against those who helped him. He dumped Hadley and the baby and took up with Pauline Pfeiffer, a decision for which he was racked with nightmares of guilt, and moved to Key West, Florida.

For some reason, he became obsessed with bullfighting: the glorification of blood, the spilt horse-guts, the matador's passes with the cape and sword, the art of killing. In Death in the Afternoon, Hemingway seemed to be working out some personal philosophy about death, but it was hard to follow. The critic Max Eastman complained that his prose style had become the equivalent of "false hair on the chest". Unable to participate directly in killing bulls, Hemingway decamped to Mombasa where he could legitimately blaze away at lions and kudu. Not content with land-based mayhem, he bought a 38-foot cruiser called the Pilar to fish, in Key West and Havana, for marlin and other aquatic creatures twice the size of himself. Between 1928 and 1936, he seemed to spend months posing beside up-ended fish trophies, the self-burnished image of the muscular man of action, handsome, tanned, drinking with the sailors in Sloppy Joe's bar.

He went to Spain during the civil war, not to fight, like George Orwell, but because he was commissioned to report on it for the North American Newspaper Alliance – and because his new love, Martha Gellhorn, was going there. He stressed many times that he wasn't taking sides, and didn't want to see the USA embroiled in a foreign war. In Madrid, despite the bombardment, he had the time of his life – enjoying caviar and vodka at the Gaylord Hotel, the Russian HQ, making a movie called The Spanish Earth and supplying its gravelly commentary, writing his broadly fictional dispatches for newspapers that criticised them as "very inefficient". He looked the part of a hunky warrior, but he was a lucky dilettante, who could have left Spain any time he liked. He wrote a play about Madrid in 1936 called The Fifth Column, about Dorothy, a plucky female journalist, who falls for Philip, a tough, intrepid, hard-drinking spy masquerading as a war correspondent. Self-projection turned into self-parody.

When America entered the Second World War in 1944, Hemingway got himself to England on "priority war business" – writing pieces about the RAF for Collier's magazine. It was a tough assignment. He took a room at the Dorchester, where he held court as the Great American Writer and went to parties, receiving compliments on his beardy, macho wonderfulness.

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

When he was concussed in a car accident that followed a drunken party with Robert Capa the photographer, Martha Gellhorn – who'd travelled to England in a ship packed with high explosives – visited him in hospital and laughed at his footling mock-heroics. As though stung into action, he headed for the war, joining the invasion fleet to Normandy and, later, General Patton's armoured divisions. He was a so-so war correspondent who was simultaneously a sort-of-warrior. At the liberation of Paris, he was found in a hotel with a small private army. When asked to leave by a French general, he liberated the Traveller's Club and the Ritz, taking a room at the latter to entertain his new love, Mary Welsh...

It's easy to be spiteful about Hemingway. All his posturing, his editing of the truth, his vainglorious fibbing can obscure his undoubted bravery. He loved being in the thick of the war – the tank advance through the Ardennes, the Battle of the Bulge – dodging bullets, watching men being shot to hell all around him. But it's hard to shake off the feeling that what he was doing wasn't bravery, but psychotic self-dramatisation. And when you inspect the image of Hemingway-as-hero, you uncover an extraordinary sub-stratum of self-harming. You discover that, for just over half of his life, Hemingway seemed hell-bent on destroying himself.

It was about the time he was finishing A Farewell to Arms, in 1928, when he learnt that his father Clarence had shot himself in the head with a Civil War revolver, that Hemingway's life first began to crack apart. The most obvious external evidence was a succession of bizarre physical accidents, many of which were bashes on the head. One, in Paris, left him with a split head needing nine stitches, after he yanked the chain in the bathroom, thinking it was the lavatory flush, and pulled the skylight down on top of him. He became weirdly accident-prone. His car accident that occasioned his row with Martha saw him hurled through the windscreen, lacerating his scalp and requiring 57 stitches. Three months later, he came flying off a motorbike evading German fire in Normandy. He suffered headaches, tinnitus, diplopia, showed speech and memory problems for months. Back in Cuba after the war, he tore open his forehead on the rear-view mirror when his car skidded. Five years later, while drinking, he slipped on the deck of the Pilar, and concussed himself. Why, you'd almost think he was trying to emulate his late father, and his self-imposed head wound.

The most egregious injury, however, occurred in January 1954. He and Mary took off from Nairobi in a small plane, heading for the Belgian Congo. Near Victoria Falls it crash-landed in a thorn thicket and Ernest sprained his shoulder. As rumours of his death spread, he and his companions were rescued and put in a 12-seater De Havilland Rapide which – incredibly – burst into flames on the runway. Finding the door jammed, Hemingway volunteered to use his head as a battering ram, butted the door twice and got out. He liked to present it as a classic example of superman pragmatism, but it nearly killed him. He fractured his skull and lacerated his scalp; cerebrospinal fluid seeped from his ear. In Nairobi he was diagnosed with grave overall concussion, temporary vision-loss in the right eye, deafness in left ear, paralysis of sphincter muscle, first degree burns on face, arms and head, sprained arm, shoulder and leg, crushed vertebra and ruptured liver, spleen and kidney. Astonishingly, he was at it again only a month later: helping to extinguish a small fire, he fell into the flames and suffered second degree burns on legs, belly, chest, lips, left hand and right forearm.

Hemingway's taste for chronic self-immolation was matched by his prodigious feats of drinking: "The manager of the Gritti Palace in Venice tells me," wrote Anthony Burgess later, "that three bottles of Valpolicella first thing in the day were nothing to him, then there were the daquiris, Scotch, tequila, bourbon, vermouthless martinis. The physical punishment he took from alcohol was ... actively courted; the other punishments were gratuitous – kidney trouble from fishing in chill Spanish waters, a torn, groin muscle from something unspecified when he was visiting Palencia, a finger gashed to the bone in a mishap with a punchbag..."

The drinking got worse after his father shot himself. Ernest went to a doctor in 1937, complaining of stomach pains; liver damage was diagnosed and he was told to give up alcohol. He refused. Seven years later, in 1944, when Martha Gellhorn visited him in hospital, she found empty liquor bottles under his bed. In 1957, his doctor friend AJ Monnier wrote urgently, "My dear Ernie, you must stop drinking alcohol. This is definitely of the utmost importance." But even then, he couldn't stop.

What was bugging Hemingway? Why all the drinking, the macho excess, the manic displays of swaggering? Why was he so drawn to war, shooting, boxing and conflict? Why did he want to kill so many creatures? Was he trying to prove something? Or blot something out of his life?

Some answers were offered in 2006 by a long article in the American Psychiatry magazine, called "Ernest Hemingway: A Psychological Autopsy of a Suicide". It was by Christopher D Martin, whose official title is Instructor and Staff Psychiatrist at the Menninger Department of Psychiatry and Behavioural Sciences at Baylor College of Medicine in Houston Texas. Martin had read widely in the 15 or so biographies and memoirs of Hemingway and offered his expert analysis – based, inevitably, at second hand, but still a convincing evaluation. He had no trouble in diagnosing the author as suffering from "bipolar disorder, alcohol dependence, traumatic brain injury, and probably borderline and narcissistic personality traits". He notes that many in the Hemingway family – his father and mother, their siblings, his own son and his grand-daughter Margaux – were prone to manic-depression (Margaux's was the fifth, or possibly sixth, suicide in four generations) and suggests that it was Ernest's manic episodes that drove him to his astonishing feats of creativity. But he locates the writer's trauma in two childhood experiences.

It seems that it was his mother Grace's habit to dress him, as a child, in long white frocks and fashion his hair like a little girl's. It was a 19th-century custom to dress infants alike, but she took it to extremes. She referred to him, in his cute lacy dress, as "Dutch dolly". She said she was his Sweetie, or, as he pronounced it, "Fweetee". Once, when Ernest was two, Grace called him a doll once too often. He replied, "I not a Dutch dolly... Bang, I shoot Fweetee". But she also praised him for being good at hunting in the woods and fishing in the stream in boys' clothes. It was too confusing for a sensitive kid. He always hated her, and her controlling ways. He always referred to her as "that bitch". He'd spend the rest of his life in a galloping parody of masculinity. Dutch dolly indeed. He'd show the bitch there was no confusion in his head.

"I shoot Fweetee." The trouble was, he also wanted to shoot his father. Clarence Hemingway was a barrel-chested, six-foot bully, a disciplinarian who beat his son with a razor strop. Ernest didn't retaliate directly. He bottled it up and subsumed it into a ritual, in which he'd hide in a shed in the family backyard with a loaded shotgun and take aim at his father's head. Martin speculates that, when Clarence shot himself, Hemingway, aged 29, felt terrible guilt that he'd fantasised about killing him. Unable to handle this, he took to blaming his mother for his father's death. "I hate her guts and she hates mine," he wrote in 1949. "She forced my father to suicide."

After Clarence's death, Hemingway told a friend, "My life was more or less shot out from under me, and I was drinking much too much entirely through my own fault". He suffered a chronic identity crisis. Henceforth he could be warm and generous or ruthless and overbearing. His friendships were often unstable (he could turn vicious or cruel, even with supposedly close pals) and his relations with women were full of conflict. He sulked like a child when, on his first safari, his wife Pauline shot a lion before he did. And he was pursued, for the rest of his life, by a colossal death wish – either to join his late father, or to expatiate his guilt at his father's death by mirroring it.

Death took up residence at the heart of Hemingway's life, a constant spur to his creative imagination, a constant companion, a dark, secret lover. Themes of violence and suicide informed his stories from the start. His letters are full of references to his future suicide. And when not contemplating his own death, he was putting himself into danger and combat as though to hasten it. Wars, rebellion, bull-running in Pamplona, big-game hunting in Africa, fishing in Havana – they were all his way of throwing himself before the Grim Reaper. "I spend a hell of a lot of time killing animals and fish," he told Ava Gardner, "so I won't kill myself."

And of course writing was his way of evading the need to die. He could polish his real-life experiences at war, in Italy, Spain, the Ardennes, and burnish his life in hindsight. Being awarded the Nobel Prize in 1954 must have been a triumphant affirmation of his genius, but he worried that, after receiving the prize, most laureates never wrote anything worthwhile again. Luckily, after finding two trunks of notes from the 1920s in a Paris hotel, he was able to manage one more book: A Moveable Feast, his touching memoir of being young, poor and happy in the French capital, with his first wife and baby, before everything started going to hell.

After 1960, however, he found he could no longer write. The words wouldn't come. Depression came instead, and with it (as we learn from AE Hotchner's memoir, Papa Hemingway), paranoid delusions. He thought that the two men he saw working late in a bank were "Feds", checking his bank account for irregularities. He thought his friends were trying to kill him. When his car slightly grazed another vehicle, he fretted that he'd be thrown in jail. It was a sorry thing, to see the epitome of "grace under pressure" succumbing to dementia.

He was given medication and, horribly, a course of electroconvulsive shock treatments. In the spring of 1961, he was asked to contribute a single sentence to a presentation volume for John F Kennedy's inauguration. Hemingway couldn't oblige. "It just won't come any more," he told Hotchner, and wept. In April, his wife Mary found him sitting with a shotgun and two shells. He was sent to hospital in Ketchum, Idaho, his birthplace, but he tried twice more to end his life, once by walking into the path of a plane taxiing on the runaway. There was a two-month period of hospitalisation and comparative peace and quiet, when he appeared sane to his doctor and deranged to his wife. He seemed to be acting, right to the end. He was released home one more time, had a picnic lunch with wine (he saw some state troopers and was sure they'd arrest him for possess of alcohol) and, the next morning, shot himself.

"The accumulating factors contributing to his burden of illness at the end of his life are staggering," writes Martin, listing Hemingway's bipolar mood disorder, depression, chronic alcoholism, repetitive traumatic brain injuries, the onset of psychosis. But it seems clear that the defining problem of his life was his experience of childhood. His confusion over gender, his Oedipal desire to kill his father for beating him, together led to what Martin calls "a retreat into a defensive façade of hyper-masculinity and self-sufficiency".

Building and sustaining the myth of Hemingway the Man's Man took courage and determination, but it was something he needed to do – and when it dwindled, along with the all-important capacity to write, he had no answer except to go the same way as his father. The image of his father, a moody, bullying, depressive man, but a role model none the less, haunted his life. He wanted to revivify him, in order to release himself from the responsibility for his death. He wanted to be the big, strong, heroic man that the world could call "Papa".

Fighter, writer, lover: a life in brief

1898 Ernest Hemingway is born in Oak Park, Illinois

1918 Wounded in Italy while working for the Red Cross during the First World War

1921 Marries first wife Hadley Richardson; they move to Paris

1923 First son John is born

1927 Divorced by Hadley, he marries Pauline Pfeiffer

1928 His father Clarence shoots himself in the head

1937 Works as a war correspondent during the Spanish Civil War

1940 For Whom the Bell Tolls is published; Hemingway marries Martha Gellhorn

1944 Reports on the liberation of Paris; begins relationship with Mary Welsh who he will marry in 1946

1952 The novella The Old Man and the Sea is published

1954 Awarded the Nobel Prize for Literature

1961 Shoots himself in the head in Ketchum, Idaho