This story started in the autumn of 1994, when I lived in a funny green house just off McArthur Park in downtown Los Angeles. From the outside, it looked like something from a Grimm's fairy tale. Inside, it felt a bit like Alice in Wonderland. When it was first built, it must have been an elegant merchant house with rich owners. Now, in decaying splendour, all of its rooms were rented out, mostly to single men.

Downtown LA is like Central America in the middle of Los Angeles. Most of the white men in the green house didn't want to be there and often displayed a barely disguised contempt for those with whom they shared their lives. One spent all day photocopying and all night in front of a TV, with a trip to Disneyland on his birthday to break the routine. Another lived out in the back garden and had converted the garage into living quarters. He occasionally gave drum lessons to Asian students - this had grown, in his own mind, to a jazz school. The guy below me played the same country and western record each evening, which he accompanied on his electric guitar, and talked about his forthcoming record deal. To prove the point, he displayed soft-focus self-portraits, dressed as a cowboy and standing in a wheat field. Another man along the corridor yodelled upside down between two chairs as he played the violin, and hoped to be spotted as he entertained on a Santa Monica boardwalk. The tale of the muscular transvestite and the Brazilian whose father was once an assassin for his country's security forces will take too long to tell. So when they all found out I was there to write a screenplay about Latino janitors, nobody batted an eyelid.

The rest of the house was filled with recently arrived Mexicans or other Latin Americans, who had crossed the border in all manner of strange and wonderful adventures.

Night-time in the green house brought its own noises. It's an LA cliche to talk of popping guns and all the madness within earshot, but this was beyond the imagination. There was an El Salvadoran gang around the corner selling drugs, a parody of gangs in a hundred films. It wasn't so much the pencil moustaches, the tattoos, the white vests to emphasise muscle and torso, that somehow struck me as strangely comic, but the three-quarter-length pants that inevitably hung at half-mast. But it wasn't funny. One evening I passed them on vigil. There was a flickering candle on the pavement beside a bottle of Corona beer, a portrait of the Virgin of Guadaloupe and a black-and-white photograph of one of their own who had been shot dead in a drive-by.

There were other noises around the green house. Cruising clients would drive down our street to eye up the ageing prostitutes. (One, six months pregnant, was a regular who would sit on our front step. Dressed in a pink floral dress and obviously suffering from Aids, she asked me if I wanted a good time.) Vibrations from their vehicles would set off the alarms on parked cars, and the endless cycle of noise would continue.

Not as frequent, but more disturbing, was the sound of the mad people who wandered the streets. To these familiar decibels of exploitation and self-destruction, typical of many inner cities around the world, were added the tambourines of an evangelical church, which proclaimed a better tomorrow as the devotees praised the Lord. "Oh sweet Jesus . . ."

In the midst of all this, as usual, were families getting on with their lives as best they could. Poverty isn't neutral. It is corrosive and vicious. One of the women who lived with us would take a knife from her bag and keep it in her hand on the short walk from the bus stop to her home. Most of the occupants of the green house had their own mugging horror story to tell, and my cowboy friend was nearly murdered during my stay. Lack of sleep, badly paid temporary work, fear outside the front door and tension within, all worked together to form a powerful cocktail that wore people down.

But not everybody took to drugs and tambourines. Some got angry. It was the sheer energy and imagination of another response, in this same community, that drew me to the janitors of Los Angeles.

The history of the Justice for Janitors campaign is explained elsewhere. But from the very beginning, several things struck me about the janitors themselves, the union organisers who worked with them, and their string of community volunteers.

Despite what seemed like impossible odds, these people exhibited remarkable confidence. Nobody here was playing some sentimental notion of the downtrodden victim. Nobody believed anything was going to change unless they did it for and by themselves; there was a roll-up-your-sleeves, get-the-work-done-now-and-stop-moaning atmosphere.

There was a clarity about how corporations functioned and how they could be confronted. This required detailed research of company ownership; perhaps a pension fund, sometimes a union pension fund, was involved, with a forthcoming AGM organised, where company abuses could be highlighted to everyone's embarrassment. Or zoning laws might provide a weak spot if the target companies were planning new buildings in other parts of the city, or perhaps tax breaks were open to challenge. There were endless possibilities, so they had to make strat-egic use of their limited resources. Blocking off just one exit from a freeway could cause chaos in the banks and offices downtown.

Confidence, like optimism, is highly contagious when mixed with hard work. So it spread. Oscars ceremonies, Thanksgiving, leading Hollywood talent agencies based in buildings where there was a new non-union contract, or whatever was in the air, gave the janitors and their supporters lots of ammunition to mount powerful counter-images to the "American dream" that masks an obscene polarisation of wealth and influence. I remember one march along Rodeo Drive, the central shopping street in the heart of Beverly Hills. Despite all the noise, the banners ("Luxury by Day, Sweatshop by Night"), the drums, police and media, the most unforgettable image was the simple contrast in size. Short brown cleaners. Tall white shoppers.

Getting to know how the campaign worked was one thing, but getting to know the cleaners and their families was another. One face sticks in my mind. She was a mother from Guatemala. With her entire savings from two and a half years' babysitting, she paid Coyotes to bring her two children up from Guatemala. They made it across the border into Mexico. (Sebastiao Salgado's wonderful series of photographs for the book Exodus Within Borders opens with a stunning vista of the border crossing over the River Suchiate.) It took them two weeks to pass through Mexico, but they got caught at the border on the US side. Her children, whom she hadn't seen since they were infants, were repatriated. Their mother started again. It was another two and half years' babysitting other people's children, two and half years' saving - but the next time, she got them through. This and other stories were told with a simple matter-of-factness. (They were amazed to hear I had filled out my visa waiver for free on a flight to LA that cost only a few hundred pounds.) Little surprise, therefore, that threats of deportation for union organising were so frightening to many cleaners who didn't have their papers. Many were repaying family members who got them across in the first place, as well as sending money home to Central America. Some were ex-students from El Salvador who had fought in the civil war; others had experience in Nicaragua during the Eighties; others came from the Guatemalan countryside or from Mexico's shanty towns. The diversity of human experience was endless. The irony was that, once they put on a cleaner's uniform, they were all treated exactly the same; as one of them told me: "You become invisible."

Many of the cleaners had two jobs and, for those who worked weekends, sometimes three. Many were scared that their kids, if left unsupervised, would join the street gangs, but it was impossible to bring up a family on the income from one cleaning job.

During this time, I was lucky enough to come across A People's History of the United States by Howard Zinn. An antidote to the sentimentality of one president after another citing God and "the American people", it never romanticises immigrants, slaves, Indians, women or workers, but opens up a continuous history of resistance in the face of hideous violence. I read of mill workers in 1835 going on strike to reduce their working day from 13 and a half hours to 11 hours. I learnt about the 100,000 workers in New York in 1872 who, after a three-month strike, won the right to an eight-hour day. And here we were in Tinseltown, home to the stars, fast approaching the year 2000, with many workers back to combined shifts in excess of 14 hours. Little wonder there was trouble.

Los Angeles, Century City, Avenue of the Stars, 16 June 1990. On this day, the Los Angeles Police Department decided to teach these upstart janitors a lesson. Century City houses some of the most prestigious office blocks in Los Angeles. It is full of media companies, Hollywood agents and other high-flyers. It was also the battleground between union organisers and a multinational cleaning company hiring non-union workers on short-term contracts, with the critical consequence that non-union workers were not entitled to health coverage for themselves or their families, to say nothing of rates of pay and other rights such as holidays.

The marchers and the police met on Avenue of the Stars. Fortunately, someone had a video, and some of this real footage is used by Ken Loach in Bread and Roses. Many protesters were beaten up, several suffered serious injuries, and one woman had a miscarriage. There was such an outcry that it led to the union's biggest breakthrough, and the cleaning companies backed down.

Since then, the janitors have continued to organise and, following city-wide protests that enjoyed huge public support, they signed a master contract in April 2000 which has had a knock-on effect on other low-paid workers across LA County. Tens of thousands of workers and their families now have healthcare. It doesn't change the world, but it transforms their lives.

Los Angeles, Century City, Avenue of the Stars, 16 June 2000. Ten years to the day when the cleaners were beaten up, in the middle of the afternoon, timed to finish so the janitors could start their shifts, the union and Lions Gate distribution company organised the US premiere of Bread and Roses at a cinema on Avenue of the Stars. Many of those who had lived through the events now watched themselves on screen. It was a premiere with a running commentary: jokes and laughter, and applause for friends they recognised.

In trying to tell this story, I found myself identifying with Zinn's approach to history. "I don't want to invent victories for people's movements. But I think that history-writing which aims simply to recapitulate the failures that dominate the past is to make historians collaborators in an endless cycle of defeat. If history is to be creative, to anticipate a possible future without denying the past, it should, I believe, emphasise new possibilities by disclosing those hidden episodes of the past when, even if in brief flashes, people showed their ability to resist, to join together, occasionally to win. I am supposing, or perhaps only hoping, that our future may be found in the past's fugitive moments of compassion rather than in its solid centuries of warfare."

I went back to see the green house. Many people had moved on, but I met my cowboy friend, who still rented the same room. "You won't believe it," he said. "I had a little romance with one of the Kennedys." "You won't believe it," I said, "but we made our film."

This is an edited version of Paul Laverty's introduction to the complete screenplay of Bread and Roses, available to NS readers at £5 including p&p (usual price £7.99). Send cheque, made out to ScreenPress Books, to: The New Statesman/ScreenPress Offer, 28 Castle Street, Eye, Suffolk IP23 7AW. Bread and Roses (15) is released at selected cinemas on 24 April. Ken Loach will answer questions after a screening at the Curzon Soho (020 7734 2255) on 27 April. Check with the cinema for details