Uganda President Yoweri Museveni, at the start of the week, signed into law the world's harshest anti-LGBTIQA+ bill. Dubbed by critics the "Kill the Gays" law, it imposes the death penalty or life imprisonment for certain same-sex acts, up to 20 years in prison for "recruitment, promotion and funding" of same-sex "activities," and the death penalty for "attempted aggravated homosexuality."
Uganda joins just a handful of countries in the world penalising lesbian, gay, bisexual, transgender, intersex, queer/questioning, asexual (LGBTIQA+) people with death: Afghanistan, Brunei, Iran, Saudi Arabia, United Arab Emirates, Yemen, Mauritania, and Somalia.
A key force behind the "Kill the Gays" bill is conservative Ugandan cultural and Christian groups in alliance with American fundamentalist churches. Their success has been spectacular, because Uganda becomes the first majority "Christian country" that has a law that specifies hanging and life imprisonment for some homosexual acts.
The "Kill the Gays" law might be shocking in its cruelty, but it is made possible by the high levels of homophobia in the country. Some polls have put opposition to homosexuality at over 90 per cent. This is strange because, in Uganda, there is a near epidemic of rape and defilement of children by heterosexual men and virtually no attacks by homosexuals.
This tells us that, like in other countries like Ghana, Kenya and Malawi, where homophobia is on a new spike, this is not about the threat paused by homosexuality. It is, first and ironically, about the terror of what the cultural and political establishments view as heterosexual deviance.
It is expressed in homophobia, which they consider an even worse form of deviance because of more hate and widespread fear of it. Because of that, it is a significant and cheap bipartisan issue that governments facing risky legitimacy crises can't resist tapping into. In fact, they need it.
This is bigger than Uganda. If one looks ahead, the news is not good – a decade of virulent homophobia and "kill the gays" laws is coming to Africa.
It is possible to see where that wave will be highest. It will be in countries failing to manage their debt and other economic crises and where elite factionalism is high — like Ghana, Malawi, Zimbabwe, and possibly Kenya. It will be mild or non-existent in countries not in debt peril (or where governments can pay it) or dire economic straits, including Botswana, Benin, Madagascar and Eswatini.
A big part of this homophobia is a response to a changing world and the fear by the old, cultural and political guardians of what they see ahead. These guardians rightly view sexual liberation and other new forms of expression as central to the new subversive order.
Not only are young Africans on a rampage of free sex that they post on their social media pages, but there are also many of them who are not doing it; they are abstaining, getting married late or not at all, or choosing single motherhood (African men today are unworthy, too many young women claim).
There is also a growing army of something the elders don't understand; African men who don't want to settle down or be fathers. Some of these young men have grandfathers who are still alive and grew up in a time when they thought it was their duty to make every young woman in their village or street pregnant, and where the only serious men were polygamists.
Their betrayal is too much.
As if that wasn't enough, there has been an outbreak of what the traditionalists describe as "uncontrollable" and "ungovernable" African women all over the place. They bow to no man (choose which one they will date long-term or sleep with for a one-night stand), have their own money and careers, and dare go out in groups and buy their own drinks.
And many African women are bisexual.
Looking at all this, the guardians think the Devil is using homosexuality to bring the collective African nation down. Criminalising gay sex, to them, the most permissive form of social liberation and "Western cultural imperialism," and shepherding the "lost sheep" back into the fold so they can produce more children to keep society strong — as their parents and grandparents did — is a strategic and national security imperative.
Therefore, the homophobic national consensus in many countries will be an important basis for nation-building and economic recovery on the continent for a while. It will get louder and nastier.
One could even argue that it would be concerning if "kill the gays" laws like Uganda's didn't come to pass. It would have suggested that there was no social transformation and disruption of the old world. Or at least not enough to worry the elders.
Uganda's anti-gay war is part of a broader proxy war, over easily the most far-reaching social and cultural transformation in Africa of the post-independence era. Great wars are made great by the stories of their heroes, and world-changing causes need martyrs.
Ugandan prisons full of people who were jailed because they wore rainbow T-shirts or were consenting adult men who kissed each other on the cheeks in their living room but were seen by a nosy peeping Tom neighbour who reported them to the police might be the cast of heroes and martyrs it needs.
They could be the bricks with which a future free society beyond the suffocating one the ruling National Resistance Movement has imposed on it for nearly 40 years is built.
Charles Onyango-Obbo is a journalist, writer, and curator of the "Wall of Great Africans". Twitter@cobbo3