Our target was the thermal power plant near a small lake almost at the centre of the city.
About 9000ft, as we turned inbound on the target, our warning lights flashed and the tone for enemy radar started sounding so loudly that I had to turn down the volume.
I could see huge clouds of smoke and dust erupt on the ground as surface-to-air missiles were fired at us. The closer we came to the target, the fiercer the defences.
I recognised the target sitting next to the small lake and dived in on it, just as the tone went off signalling that a missile was flying towards me.
I knew I should roll out and fly evasive manoeuvres - "jinking" in flyers' parlance - but I was just about to release my bombs and, had I started jinking, I would never have had the time, nor probably the nerve, to go back in once I had lost the missile.
So at 1000m, I released my bombs, then pulled back the stick to begin a steep climb to a safer altitude. In the instant before the plane reacted, a missile blew my right wing off.
I knew I was hit. My A-4 aircraft, travelling at about 900km/h, was spiralling violently to Earth. I reacted automatically the moment I took the hit, reached up and pulled the ejection seat handle.
I struck part of the aircraft, breaking my left arm, my right arm in three places and my right knee, and was briefly knocked unconscious.
Witnesses said my chute had barely opened before I plunged into the shallow water of Truc Bach Lake.
Wearing about 25kg of gear, I touched the bottom of the lake and kicked off with my good leg. I did not feel any pain as I broke the surface and I did not understand why I couldn't move my arms to pull the toggle on my life vest.
I sank to the bottom again.
When I broke the surface the second time, I managed to inflate my life vest by pulling the toggle with my teeth. Then I blacked out again.
When I came to the second time, I was being hauled ashore on bamboo poles. A crowd of several hundred Vietnamese gathered around me, stripping my clothes off, spitting on me and kicking and striking me.
When they had finished removing my gear and clothes, I felt a sharp pain in my right knee. I looked down and saw that my right foot was resting next to my left knee at a 90 degree angle.
I cried out: "My God, my leg!"
Someone smashed a rifle butt into my shoulder, breaking it. Someone else stuck a bayonet in my ankle and groin. A woman, who may have been a nurse, managed to dissuade the crowd from further harming me. She then applied bamboo splints to my leg and right arm.
It was with some relief that I noticed an army truck arrive on the scene. The soldiers placed me on a stretcher, loaded me into the truck and drove a few blocks to the French-built prison, Hoa Lo, which the PoWs had named the Hanoi Hilton.
As the massive steel doors clanked shut behind me, I felt a deeper dread than I have ever felt since.
The date was October 26, 1967. I was 31 and a lieutenant commander in the US Navy when I was shot down.
For two centuries, the men of my family were raised to go to war as officers in America's armed services.
I was the son and grandson of Navy officers and my father trusted that when I met with adversity, I would use the example he had set.
The soldiers took me into an empty cell, set me down on the floor still on the stretcher and placed a blanket over me. For the next few days, I drifted in and out of consciousness.
My interrogators accused me of being a war criminal and demanded military information. They knocked me around a little and I began to feel sharp pains in my fractured limbs.
I blacked out after the first few blows.
I thought if I could hold out, they would relent and take me to a hospital.
But on the fourth day, I realised my condition had become more serious. I was feverish and losing consciousness for longer periods.
I was lying in my vomit and other bodily wastes, and my knee had become grossly swollen and discoloured.
The medic, called Zorba, took my pulse.
"Are you going to take me to the hospital?" I asked.
"No," he replied. "It's too late."
Panic that death was approaching overtook me: the Vietnamese usually refused treatment to the seriously injured. Blessedly, I lapsed into unconsciousness.
I was awakened a short while later when the camp officer, a mean son of a bitch called Bug, rushed excitedly into my cell.
"Your father is a big admiral," he shouted. "Now we take you to the hospital."
God bless my father.
It was hard not to see how pleased they were to have captured an admiral's son and I knew my father's identity was directly related to my survival.
I was moved to a hospital in central Hanoi. Coming to a couple of days later, I found myself lying in a filthy room, lousy with mosquitoes and rats.
Every time it rained, mud and water would pool on the floor. No one had even bothered to wash the grime off me.
I began to recover my wits and my interrogators came to the hospital to resume their work. The beatings were of short duration because I let out a hair-raising scream when they occurred and my interrogators appeared concerned that hospital personnel might object.
Eventually I gave them my ship's name and squadron number. When asked to identify future targets, I recited the names of north Vietnamese cities that had already been bombed.
In early December, they operated on my leg, severing all the ligaments on one side of my knee, which has never fully recovered.
In late December, they decided to discharge me. I had a high fever and suffered from dysentery. I had lost about 25kg and weighed barely 45kg. I was still in a chest cast and my leg hurt like hell.
I was blindfolded, placed in the back of a truck and driven to a prison called The Plantation.
To my great relief I was placed in a cell with two other prisoners, Air Force majors "Bud" Day and Norris Overly. There has never been a doubt that Bud and Norris saved my life.
They later said their first impression of me, emaciated, bug-eyed and bright with fever, was of a man at the threshold of death.
They thought the Vietnamese expected me to die and had placed me in their care to escape the blame when I failed to recover.
Bud had been seriously injured when he ejected. After he was captured, he had attempted an escape and had almost reached an American airfield before he was recaptured.
His captors had looped rope around his shoulders, tightened it until his shoulders were almost touching, and then hung him by the arms from the rafter of the torture room, tearing his shoulders apart.
Left in this condition for hours, Bud never acceded to Vietnamese demands for military information. They had to break his already broken right arm a second time, and threaten to break the other, before Bud gave them anything at all.
Because of his injuries, Bud was unable to help with my physical care. Norris, a gentle, uncomplaining guy, cleaned me up, fed me and helped me on to the bucket that served as our toilet.
Thanks to them, I began to recover. Soon I was able to stand unaided and even manoeuvre around my cell on a pair of crutches.
In April 1968, Bud was relocated to another prison. Norris had been released under an "amnesty" and I would remain in solitary confinement for more than two years.
Though I could manage to hobble around on my crutches, I was in poor shape. I couldn't pick up or carry anything.
The dysentery caused me considerable discomfort: food and water would pass immediately through me, and sharp pains in my stomach made sleeping difficult.
It's an awful thing, solitary. It crushes your spirit and weakens your resistance more effectively than any other form of mistreatment.
Having no one else to seek counsel from, you begin to doubt your judgment and courage.
The first few weeks are the hardest. The onset of despair is immediate, and it is a formidable foe. I reconstructed from memory books and movies I had enjoyed.
I tried to compose books and plays of my own, acting out sequences in the solitude of my cell.
I had to carefully guard against my fantasies becoming so consuming that they took me permanently to a place in my mind from which I might never return.
My cell was directly across the courtyard from the interrogation room. It had a wooden board for a bed and a naked light bulb dangling on a cord in the ceiling. The light was on 24 hours a day.
Adding to our discomfort was the building's tin roof, which must have increased the summer heat by five or more degrees.
In mid-June 1968, the camp commander, over an inviting spread of biscuits and cigarettes, asked me if I would like to go home.
I wanted to say yes: I was tired and sick and I was afraid.
But the Code of Conduct was explicit: "American prisoners cannot accept parole or amnesty or special favours."
I said I would think about it. I knew how my release would affect my father and my fellow prisoners, and I discovered later what the Vietnamese hoped to gain.
On July 4, my father had become Commander in Chief, Pacific. The Vietnamese intended to hail his arrival with a propaganda spectacle, releasing his son as a gesture of "goodwill".
For almost two months, nothing happened. Then the punishment sessions began. I was hauled into an empty room and kept there for four days. At intervals, the guards returned to administer beatings.
One guard held me while the others pounded away.
They cracked several of my ribs and broke a couple of teeth. Weakened by beatings and dysentery, with my right leg again almost useless, I found it impossible to stand.
On the third night I lay in my blood and waste, so tired and hurt that I could not move. Three guards lifted me to my feet and gave me the worst beating yet. They left me lying on the floor moaning from the stabbing pain in my re-fractured arm.
Despairing of any relief from pain and further torture, I tried to take my life. After several unsuccessful attempts, I managed to stand. Up-ending the waste bucket, I stepped on it, bracing myself against the wall with my good arm.
I looped my shirt through the shutters. As I looped it around my neck, a guard saw the shirt through the window, pulled me off the bucket and beat me.
Later, I made a second, feebler attempt at suicide. On the fourth day, I gave up. I signed a confession that "I am a black criminal and I have performed the deeds of an air pilot".
The guards ordered me to record my confession on tape. I refused, and was beaten until I consented.
Those were the worst two weeks of my life. I shook, as if my disgrace was a fever and no one would ever look on me again except in pity or contempt.
The Vietnamese never seemed to mind hurting us, but they usually took care not to put our lives in danger.
We strongly believed that some PoWs were tortured to death and most were seriously mistreated.
One man, Dick Stratton, had huge infected scars on his arms from rope torture. His thumbnails had been torn off and he had been burned with cigarettes.
However, the Vietnamese prized us as bargaining chips in peace negotiations and they usually did not intend to kill us when they used torture to force our co-operation.
By the end of 1969, routine beatings had almost stopped. We occasionally received extra rations. Our circumstances would never be as dire as they had been in those early years.
I was released and flown home at the end of the war, in March 1973. I had been incarcerated for 5 1/2 years.
We were told to have faith in God, country and one another. Most of us did. But the last of these - faith in one another - was our final defence, the ramparts our enemy could not cross. This was the faith I had embraced at the Naval Academy.
It was my father's and grandfather's faith. In prison, a filthy, crippled, broken man, all I had left of my dignity was the faith of my fathers. It was enough.
Adapted and extracted from Faith of My Fathers, by John McCain