Reinaldo Arenas was thrown in jail by Castro and later killed himself in New York. Now an Oscar-nominated film celebrates the life of this controversial Cuban writer

In 1970, two novelists shared a literary prize. Gabriel García Márquez's One Hundred Years of Solitude and Hallucinations by Reinaldo Arenas won joint first prize for best foreign novel published in France. The first of these people, a Colombian, was a supporter of Castro. He is still alive, has since won a Nobel Prize and has become the most famous Latin-American writer in the world. The other, a Cuban homosexual who had grown up poor in the provinces, was imprisoned by the revolution he had initially sought to join. He died 11 years ago and remains virtually unknown.

Now the painter and filmmaker Julian Schnabel has made a movie about Arenas's life, Before Night Falls, based on the memoirs of that title that were published after the writer's death. It's a beautiful, artful film, and received quiet praise until Javier Bardem, who plays the lead role, was nominated for an Oscar alongside Russell Crowe and Tom Hanks. Suddenly, the world paid attention - both to the actor, and to the man himself.

Bardem's performance is extraordinary. The Cuban writer Guillermo Cabrera Infante, who left Havana in 1965 and knew Arenas, says: 'It's the work of a chameleon. I met Bardem when Schnabel wanted him to make the movie and I thought, no no, you've got it completely wrong. He's a tall man with a thick Castilian accent. And I don't know how he did it - he imitated Reinaldo in ways he couldn't have known about - his voice, that languid way he walked, keeping his arms stiff at his sides. I've seen photographs of Bardem and thought it was Reinaldo. It really is uncanny; there's no other word for it.'

The memoir begins in Holguín, in the eastern part of Cuba, where Arenas was born in 1943. He was a self-professed guajiro, or hick, who grew up eating dirt and climbing trees; he had never known his father, and lived surrounded by generations of women. Soon, this idyll gave way to another, which was to govern the rest of his life, what one critic called his 'pansexuality'. No farm animal or pet was immune to the young Arenas's sexual appetite; the erections of uncles and horses are remembered graphically and with equal fondness.

Arenas worked in a guava-paste factory as a teenager, but, as the economic situation worsened under the Batista dictatorship, his family had little food and no electricity. He decided to run away from home and join Castro's rebels when he was 15.

When Castro was in power, Arenas was given a scholarship to study agricultural economy. He was able to continue his studies in Havana, but his career made a permanent detour when he won a short-story competition in 1963, and was given a job at the National Library. He became a protégé of two of Cuba's best writers, José Lezama Lima and Virgilio Piñera. His first two novels won prizes from the Cuban Writers' and Artists' Union (UNEAC), but only the first, Celestino Before Dawn, was, or ever has been, published in his own country.

The second novel was Hallucinations, which gave a fictional account of an exiled, eighteenth-century Mexican monk, Friar Servando, who is tortured and imprisoned. It was interpreted as a political analogy, of course, but even more offensive to the regime was the fact that Arenas somehow managed to smuggle the manuscript out of Cuba and have it published in Mexico and Europe.

According to Cabrera Infante: 'It all started with his manuscript of Hallucinations. Really, they should have been more intelligent, because after all, he was a product of the revolution. He was a peasant, incredibly poor, and he was educated by the revolution. But they didn't take any of that into account and turned his case into a cause célèbre . They were stupid, more than criminal.'

The prize that book won in France only had the effect of placing Arenas under continuous surveillance by state security. They wanted to know who his contacts abroad were, how he had got the manuscript out, where he kept the rest of his writings. He hid his manuscripts in cement bags and gave them to various friends. One friend destroyed what he was given, another turned out to be an informer. Arenas chained his typewriter to his desk. In Before Night Falls, Arenas reflects on what has happened to the talented young writers of his generation. They were executed, or became alcoholics, or killed themselves, or turned into informers. But those who kept going had to read to each other in secret, arranging clandestine meetings in people's houses or in rented rowing boats out at sea.

Writing, as it comes across in the memoir, is a life force, the only thing that enables Arenas to 'endure a thousand adversities'. He writes one novel three times, refusing to give in to the continual disappearance of his manuscripts. These papers - lost, destroyed, salvaged, smuggled - become a kind of talisman, a tangible way of thinking about freedom. The last piece of advice he receives from his mentor, Lezama Lima, before he dies is: 'Remember that our only salvation lies in words.'

Salvation lay in sex too. The variety of Arenas's encounters is so extreme it seems improbable (at one point, some boys become aroused while they are trying to mug him; they all have sex before the boys run off with his wallet). And their frequency is such that had Schnabel shown them all, his movie would have been pure snuff. But he shows enough for us to see that sex, for Arenas, was a kind of revolution, a life force against the oppression of politics. 'He could no more change his sex than he could change his nature to be a writer,' Schnabel explains, 'and the combination of those two things at that moment in history was very, very volatile.'

The regime was already on his case, but when Arenas was finally arrested, it was, ostensibly, on a charge of corruption of minors that was later to prove unsubstantiated. Still, for this he was put in El Morro castle, a colonial fortress that had been converted into the country's toughest prison. His descriptions are harrowing - there were 250 men to a cell, the stench was unbearable and, at one point, he was put in solitary confinement with no air or food, in a room too small to stand up in. After years of this treatment, and repeated interrogation, Arenas agreed to sign a confession, and a statement promising that he would, from then on, only write 'optimistic books'.

El Morro is now a tourist attraction. There is no sign at all of its having been a prison. You can walk around the ramparts, climb to the top of the lighthouse and wander around the roof where the prisoners used to be let out into the sun once or twice a month. From there, Arenas wrote, 'we could look at the city of Havana, the city of our suffering, but which from up there seemed like paradise'.

When I went there last month, a man beckoned me to a small cabin on the roof. 'You'll get the best view of Havana from here,' he said. The men - there were several generations of them - turned out to be harbour masters. They had radios connecting them to the rest of the world, a telescope through which they could see, right up close, anything that was happening on the other side of the bay, and an uninterrupted view of the roof.

'How long have you been here?' I asked.

'If you put us all together, 108 years'.

'So you would have been here when it was a prison?'

'Yes,' they said, a little apprehensively.

'It's just that I can't find any trace of it. I'm not sure where it was.'

'No, you won't find any trace of it,' one of them said, taking me by the arm and showing me the central building, 'because you see those ornamental wooden rods in the window frames? They all used to be metal bars.'

'Did you talk to any of the prisoners?' I asked.

'Sure. Some of them were quite comical. There weren't any serious criminals in here, you know, no murderers or rapists. They were just here for reasons that were...'

He didn't finish his sentence, and the oldest man muttered something under his breath: '... political.'

In 1980, Reinaldo Arenas managed to get to Miami on the Mariel boatlift. He was filmed by Jana Bokova for her BBC documentary, Havana, and the interview she did with him was what inspired Schnabel to make Before Night Falls. It's an extraordinary portrait. Arenas chats about his childhood, speaks lightheartedly about the ironies of his life and shows her around his kitchen. He eats baby food, he explains pragmatically, because when he's writing he just has to open a jar from the fridge and he gets all his nutrition from there.

Guillermo Cabrera Infante met him then, too, and says he was 'very well, delighted at having escaped, and having got the better of the police who had persecuted him. He became a hero of exile - I wish you could have heard him, at a conference in Washington. He was extraordinary, improvising before an audience. He was applauded like mad, and people were throwing money at him - American coins'.

Arenas was able to write, and publish, what he wanted in exile, and his criticism of the regime - though always ironic and Kafkaesque - became more open. He was deserted then by people from whom he might have expected support, and who felt he had, in leaving, let down the Left. In The Colour of Summer, published posthumously, he wrote what might be seen as a coded self-portrait from these times, in which a man who is born too big for an island is expatriated. His voice is so loud and his speech so beautiful that his friends as well as his enemies are jealous, and he is killed. Later in the same book Arenas wrote a parable about Cuba: an island comes unstuck from its base and floats away like an enormous ship. The islanders are ecstatic, but they can't agree on which direction to steer their country in, and they argue for so long that the island and all of its people sink.

Arenas later moved to New York. 'But he had a problem,' says Cabrera Infante, 'which was his sexual promiscuity. We saw him at a film festival in Miami, and my wife, Miriam Gomez, told him he had to be careful because if he got ill it would be terrible for him, but a source of great joy for those in Cuba. He said, "Don't worry, my little black friends are very clean". His idea of sexual hygiene was just a quick wipe with a towel or something, I don't know! It was ridiculous, but also pathetic. That was what cost him his life.' Arenas contracted Aids. He raced to write his memoirs, before 'the dark night of death' fell on him.

'You'll never find a copy of Before Night Falls in Cuba,' Julian Schnabel says of the book. Of his own film, he says: 'This movie is made for the Cuban people; I wish they could see it.' I tried to find Arenas's memoir in Havana, asking all the booksellers on the street and in every shop. The answer was no, but from time to time there would be a rumour - someone had 'The Book' but wasn't there today; someone had them all but didn't want to sell them. I had resigned myself to the fact that none of Arenas's words had survived with those for whom he had written them, when I heard a hiss across the street.

'Pssssssst! Psssssssst! Señorita!'

The man was holding a copy of Celestino Before Dawn, Arenas's first book, whose name so perfectly mirrors his last. It was a first edition, one of 2,000 copies published in Cuba in 1967. Although it was not exactly contraband (that book was not censored there), there was something moving, somehow, about the find, a symbolic message, perhaps, about the true freedom of Arenas's speech.

In 1990, Arenas ended his own life, leaving several addressed letters behind. Each envelope contained the same words:

'Dear friends,' he wrote,

'Due to my delicate state of health and to the terrible emotional depression it causes me not to be able to continue writing and struggling for the freedom of Cuba, I am ending my life... You are the heirs of all my terrors, but also of my hope that Cuba will soon be free... I already am.'

Julian Schnabel's film is released on 15 June. Before Night Falls by Reinaldo Arenas is reissued on the same day by Serpent's Tail, £8.99