It is now 40 years since the start of a riot for freedom in a small tavern in New York City – and the riot has never stopped. It is spreading slowly across the world, to every continent, to Mumbai and Shanghai and Dubai. Everywhere it goes, it wins, in time. Yet on 28 June 1969, it seemed only like another Sixties ruck in the muck against corrupt cops. The Stonewall Tavern was a Greenwich Village bar where gay people huddled together to find friends and lovers in a hostile country on a hostile planet. It was a hangout for everyone from macho bikers to drag queens making the pilgrimage from Ohio and Iowa and Kansas. One of the regulars said that until he discovered the bar "I felt like I was the only one... I only knew enough to hide". The regulars were harming nobody, they were only enjoying themselves, but the local police force was fond of busting the bar and beating and imprisoning the clientele. They only allowed the bar to stay open at all because they were being bribed by local gay gangsters.

But one day, gay people decided they had had enough of cowering and hiding and being told they were sick. On the day of Judy Garland's funeral, the police smashed their way into the Stonewall. The historian Martin Duberman distills what happened next into a single image: "A leg, poured into nylons and sporting a high heel, shot out of a paddy wagon into the chest of a cop, throwing him backwards." The drag queen yelled: "Nobody's gonna fuck with me no more!" And the global riot began.

It was the turning point in the fight for equality for gay people. Within four decades, goals that would have seemed impossible to those fighters that night were achieved: openly gay prime ministers, gay marriage in Europe and parts of the US, legal bans on discrimination. The gay rights movement was a cry for the right to love in the darkness. It is a model of democratic pressure: a minority peacefully appealing to the decency of the majority, and prevailing. It is the strongest antidote to cynicism that I know.

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

The conversation about gay people has been so soaked in theology for so long that it is important to state some hard empirical facts. Homosexuality is a naturally occurring phenomenon that happens in every human society. Everywhere, about 2 to 5 per cent of human beings prefer to have sex with their own gender. It occurs at the heart of nature: only last week, Professors Nathan Bailey and Marlene Zuk, of the University of California, concluded in a study: "The variety and ubiquity of same-sex sexual behaviour in animals is impressive – many thousands of instances of same-sex courtship, pair bonding and copulation have been observed in a wide range of species, including mammals, birds, reptiles, amphibians, insects, molluscs and nematodes."

Birds do it, bees do it, even educated fleas do it. It doesn't mean anything. It is a harmless genetic quirk. It has always happened and it always will. The only question is: do you want to be spiteful to gay people, or let them express their most natural urges peacefully? In the US and Europe, steadily and remarkably quickly, the civilising voices are winning. There is still a lot to do. Gay teenagers are six times more likely to commit suicide than their straight siblings but the trajectory is ever-upwards. In much of the developing world, gay equality is inching forward too. After extraordinarily brave men and women fought back, India is poised to decriminalise homosexuality this year and China has just seen its first ever Gay Pride parade. But there are three great swathes of humanity still untouched by the spirit of Stonewall – and terrified, terrorised gay people there are screaming for help. In the Caribbean, majority-Muslim countries and most of Africa, being gay is a death sentence, yet many people who should be showing solidarity choose not to see it.

Jamaica is Taliban Afghanistan for gay people. If caught, gays and lesbians face 10 years of hard labour, but they are more likely to be lynched. The cases documented by Dr Robert Carr, of the University of the West Indies, fill whole books. Here are two from a single week: a father found a picture of a naked man in his 16-year-old son's rucksack, so he produced it in the playground and called on the boy's classmates to beat him to death – which they promptly did. No one was ever charged.

In Montego Bay, a man was caught checking out another man, so the crowd lynched him. When police arrived, they joined in. Hospitals routinely refuse to treat the victims of gay-bashings, leaving them to die, yet people who would never have dreamed of holidaying in apartheid-era South Africa still flock to Jamaica's beaches. A heroic Jamaican called Brian Williamson set up an organisation called J-FLAG to campaign for the rights of gay Jamaicans. His body was found stabbed and slashed 70 times. The police did nothing. The most popular song in Jamaica in recent years – by Beenie Man – choruses: "I'm dreaming of a new Jamaica, come to execute all the gays... Take dem by surprise/ Get dem in the head."

Throughout Muslim countries, gay people are routinely jailed, tortured and hanged. Mahmoud Ahmadinejadh denies there are any gay people in Iran, but is happy to have them executed in public squares. In post-invasion Iraq, there has been a homo-cidal pogrom of gay people being led by private Islamist "morality squads". In the past two months, 25 gay men's corpses have been found mutilated in one Baghdad slum, Sadr City, with notes saying "pervert" pinned to their chests. Ayatollah Ali al-Sistani, the country's leading religious cleric, says gays should be killed "in the worst way possible" – and they are obeying. Men are now being killed by having their anuses glued shut.

In Africa, one country has been a beacon for gay rights. Post-apartheid South Africa even has gay equality written into its constitution. Yet even it is now headed by a man, Jacob Zuma, who brags about beating up gay men in his youth.

The gay people cowering in these countries are asking for our support – by funding their underground organisations, by putting gay rights on the diplomatic agenda, and by consistently granting asylum to the victims of homophobic persecution. Today, some gay people seeking safety are given the right to remain, while others are told to go back and hide their sexuality. But too many people avert their gaze from the murderous, homophobic persecution happening now and, even more shockingly, some condemn the people who are trying to stop it. Peter Tatchell, one of the great figures of the fight for gay equality, has for years been organising practical support for gay Jamaicans, Muslims and Africans. They have been incredibly grateful, but he has been pilloried by people who pretend to be left-wingers here as "racist" and "imperialist".

How is it "racist" to side with black and Muslim people who are being hunted down and murdered by other black and Muslim people? How is it "imperialist" to peacefully support their struggle, as they are begging us to? Should we say to the successors of Brian Williamson – sorry, but we can't help you today, because the descendants of your torturers and murderers were subject to British imperial rape a century ago?

That would be real racism: to cheer a Stonewall for white people on the streets of New York City, but to ignore it on the streets of Kingston or Cairo or Kinshasa, just because the homophobic cops there happen to be black or Arab. Homosexuality happens everywhere, so gay people fight for the freedom to be themselves everywhere. The Stonewall riot, and its high-heeled kick, isn't over; in many places, it has only just begun.

You can support gay rights organisations in the most homophobic parts of the world. To support gay Iraqis, donate here. To support gay Jamaicans, donate here. To support Peter Tatchell extraordinary campaigns against homophobic discrimination everywhere, click here.

To read Johann Hari's latest article for Slate magazine - about the life and death of the Asian babe - click here.

j.hari@independent.co.uk