n 1985 the Irish writer Joseph O'Connor lost his mother in a car accident. Numb with shock, the 21-year-old shunned the support of his family and travelled alone to Nicaragua. Here, against a backdrop of post-revolutionary courage and chaos, he learned to count his blessings…

June 1985. I'm aged 21. I'm flying to Nicaragua, alone. I speak hardly any Spanish, am totally unprepared, know nobody at all in the whole troubled country, which is in the grip of a war in which thousands are dying. I haven't even had the required inoculations. (Coward that I am, I'm afraid of injections.) In an hour or two, these will be administered to me here on the plane by the Swedish doctor who happens to be seated across the aisle from me. She's going to warn me that if I enter Nicaragua without having had them, I'll find myself in intensive care "or the morgue". She thinks I'm half crazy. In a way I am. But not in the way she believes.

On a Sunday morning four months ago, my mother was killed in a car crash, in Dublin, my childhood home. Her departure, so sudden, so shocking and violent, means all kinds of resolutions can never happen. A charismatic, mercurial woman, she had many gifts, but the ability to be a good mother wasn't one of them. Our family hasn't been happy; my parents' marriage ended in the courts. Her death leaves unanswered questions.

I'm miles above the Atlantic. The flight attendants are Russian. Aeroflot is the only way of getting to Managua from Ireland. In order to be on this flight I had to have a three-day layover in Moscow, where people whisper in the streets that communism is dying. But I'm certain it will always exist.

Three days in Moscow. I spent one of them asleep: dream images of my family, of the house I grew up in; of the Connemara coastline where we'd holiday in the summers with our parents. When I woke to what I thought was Wednesday in Moscow, it was actually Thursday; the hotel manager banging on the door, looking frightened.

A newly married couple visiting Lenin's tomb in Red Square. Prostitutes on the steps outside the Bolshoi. People approaching you to buy jeans, or dollars, or a Walkman. Street signs you don't understand. Every emotion you have, even the numbness of grief, seems to be written in Cyrillic: inverted, unreadable.

The plane roars through the sky. People around me are sleeping. I'm thinking about my friends back in University College Dublin. We're interested in politics, in South Africa, in Latin America. It comes back to me now, as the plane slowly banks, how we congregate in the Belfield Bar on a Friday night, to drink the two or three pints we are able to afford, and to talk with such fervency about Nicaragua. The Sandinista revolution happened there, in 1979. People say it's a new kind of third world society. There have been no executions; torture has been banned. The revolutionaries are teaching people to read.

My friends and I get to-gether and talk about these things, with the indefatigable idealism of the young. There's a classmate I fancy, but I'm too nervous to tell her. It's Friday night now. She's probably there, in the bar. She dresses like Madonna, in a miniskirt and leggings, with rosary beads as jewellery and a tight black bodice. An Oxfam fatale, heartbreakingly beautiful. There was one night when a group of us were at a party in somebody's flat, and she turned to me and smiled, and I felt I could stir the stars around in the sky. And if only I had been able to say what I felt, but instead I clammed up, looked away.

Bob Dylan has a line in "My Back Pages": "I was so much older then/I'm younger than that now." Most of us in my group are the children of divorce, a fact we never talk about; perhaps we know it's what binds us. Late in the evening, with the Clash and the Specials blasting bravely from the jukebox, my friends and I tell each other we're going to visit Nicaragua one day. But some of us know we've no intention of ever doing such a thing. It's only something you say in the pub.

Then my mother died four months ago and everything changed. She was driving to Mass, my younger brother in the back seat, and her car went into a skid. I can't summon to my mind what happened next. I don't want to picture it. Most of all, I don't want to hear it. It was a Sunday when I thought I would meet my friend in town to play pool, but it became the morning I would formally identify my mother's body.

The days following are a blur, the spokes of a turning wheel. She had written in her will that she did not want to be buried in a shroud. My sisters and I, in a store in downtown Dublin, silent with the exhaustion of sleeplessness and loss, going numbly through racks of dresses. Poised somewhere between trauma and absurdity and fear. What shoes do you buy? Is it OK to laugh? Is gaiety only desolation turned brave?

Grief comes to us in many dresses, some of them strange. The way it affected me was that I wanted to disappear. There was help on offer from family. I was lucky to be offered it. But for some reason I don't understand I long to be by myself; a haven where I can be totally alone. I don't want sympathy. I've nothing to say. I can't bear to be reassured, condoled with, understood. And that's the only reason why I'm on this plane tonight, to a place where I know nobody at all.

There's going to come a time, many years from this moment, when I'll be astounded that I did something as naive. But that time isn't now. I'm not thinking about the future. Yesterday feels 10 years ago, tomorrow is unreachable. You do remarkably foolish things when you're 21. It's amazing that any of us survives youth.

The bus ride from the Augusto César Sandino airport. No windscreen in the bus. The driver with one arm. Soldiers manning the rooftops of the burnt-out buildings on either side of the Pan-American Highway. Graffiti on every wall. "Frente Sandinista!" "Viva Nicaragua Libre!" "Muerte a los Yanquis!" Red and black banners, tattered on their masts. Armoured cars in a schoolyard.

I find a room with a family in the centre of Managua, a city wrecked by an earthquake in 1972 and never rebuilt by the dictatorship. The Somoza clan, which ruled the country as a personal fiefdom, pocketed millions intended as aid. In this district, only the cathedral and the Bank of America survived: proof, the locals say, of whose side God is on. But the people are subtly welcoming and warm. A taxi driver greets me with the last words I expected to hear: "Irlanda? U2? I like."

They're tough, intelligent; curious about outsiders. The children of the family ask questions. Is there a zoo in Ireland? Do you like Michael Jackson? Why did you come here? How long will you stay? Why does the light burn in your room all night? Do people play baseball in Ireland?

The wrecked city is full of Americans, college kids mostly, who've come down to pick coffee on the brigades. And there are Londoners, Glaswegians, a trade union group from Leeds, mingling some evenings in the garden of the InterContinental Hotel with European journalists and aid workers. One night a convoy of military vehicles roars up to the doors. Armed bodyguards take positions in the lobby. A short, chubby general strides into the restaurant, sitting alone at a table, delicately eating a piece of cake. He is Commandante Tomas Borge, one of the senior members of the ruling FSLN coalition. He was tortured by the dictatorship and spent years in solitary confinement. It is rumoured that, following the revolution, he found the National Guardsman who had tortured him, and said: "My revenge is that I forgive you." Nobody approaches him as he eats his cake, occasionally brushing the flies from his epaulettes.

Most days I go to the barrio's market and see no food at all – the United States government is blockading the country – but somehow the people contend with appalling circumstances, rarely losing the sardonic stoicism that reminds me of how inner-city Dubliners talk. Aero Nica is the name of the inefficient national airline. Its nickname is Aero Nunca: "Air Never".

At night there is fear. Not sadness, not bereavement. My mother's absence drifts out of Managua's ruins in the clothing of fear. It comes and it goes, like the power cuts or the water or the rumours that there might be bread tomorrow. And in a strange, new place, whose ways you don't understand, there is plenty to be afraid of in the night. Shouts in the street. Scorpions. Fever. Rumours of an invasion. Rumours of disease. The men on the corner by the Cine Dorado, rifles and machine guns in their hands.

I drift around the country, write a couple of long articles. These are published back home, in newspapers and magazines. There's a day in the Managua post office when I manage to put a phone call through to my father in Dublin. When he tells me how proud he is to see my stuff in the paper, I feel tears running down my face for the first time in years.

"Your mother would be proud, too," he adds through the crackle.

I find I can say nothing at all.

Lately I'm daring to give into a feeling I've been having for a while – that I'd love (Jesus Christ, could I even admit it?) to write a novel one day in the future. Could that ever be possible? An unattainable hope. And is there anything more irrelevant than a novel? My first attempts at fiction are scrawled in Managua, a devastated city where you can drink all night. Nobody knows you. Nobody cares. You can sit there with a notebook and no one looks twice at your fumbling, graceless sentences that will never be read. You really don't matter. You are nothing.

At dawn I often walk by the shores of Lake Managua, staring at the wild flowers that grow in the cracks of dead buildings: malinche, the flowers are called. The local people say they were named by Cortez, the assassin of thousands, for a beautiful slave girl he loved. On a mountainside beyond the city, the giant letters FSLN are carved in white stone, a bleakly ironic nod towards the Hollywood sign perhaps. The silhouette of Sandino appears on every wall, an image of spray-can defiance.

And outside the city, the landscape is aching. Volcanoes, banana plantations, shimmering lakes. Once- glorious haciendas, now burnt to their skeletons; tiny cardboard hovels adorned with portraits of Che or the Sacred Heart. Everywhere there is music: the joyous strut of salsa. Ragged children playing baseball by the headlights of jeeps. Death is all around: the newspapers are full of it. But the people refuse to let it win.

I'll come home a changed person, but I don't know that yet. This is going to be the summer I grow up; everyone has one. I'll learn all sorts of things, some little, some immense. Spanish, not English, is the most expressive language for poetry, and also, bizarrely, for cursing. Nicaraguans are among the handsomest people in all the world. Politics is not about spouting slogans, nor always a matter of right and left, but ultimately a question of right and wrong; a jaded, sententious cliché that happens to be true. I'm going to learn that the only things worth achieving are accomplished when courageous people combine their efforts to make things better for one another. The tyrant can be defeated. It is possible to walk out of the tomb of the past. Half a life later, I'll still remember this summer; I'll still see it in dreams and wonder if I was ever there. And the main thing I'm going to learn, I'll try to remember once a day, especially on the dark days, which still come sometimes. If you have enough to eat, and a safe place to sleep, and nobody wants to kill you or take you from your family, you are among the most fortunate few of a troubled world, and you should never forget your sheer luck.

Joseph O'Connor is a novelist and journalist. his latest novel, Ghost Light, is published by Harvill Secker.