A version of this piece appeared in Africa and Asia. The views expressed are the author's own.

Men walk hand in hand with other men throughout village Africa, and even in cities. Almost everywhere affection and love between men and between women has been common, and generally accepted. None of this behavior has heretofore been in the closet, but now it must be -- given draconian punishments recently mandated by legislation in Nigeria, Uganda, and other sub-Saharan countries.

Until relatively recently, Africans were comparatively tolerant of what is now being excoriated as deviancy. Admittedly, President Robert Mugabe of Zimbabwe has long used harsh expletives against gays in his own country and overseas; fundamentalist clergy have preached against homosexuality; Anglican clerics in Nigeria and other African countries have passionately opposed the elevation of gay priests to bishoprics; and courts such as in Malawi have occasionally tried men who embraced other men.

Nowadays only nine Francophone African countries, plus South Africa, accept a common African reality that, in the past, many tribes of Western anthropologists, colonial administrators, novelists, and other acute observers have long recognized.

What has changed? Why, in 21st-century Africa, has gay bashing become so popular? What is so threatening now, and why have there been so many attacks on homosexuals in the past five years, especially in hitherto tolerant places such as Uganda?

Mr. Mugabe and a number of fellow African presidents, especially in Nigeria and Uganda, court popular approval for political reasons. But they may – like so many of their parliamentary compatriots – have mostly manly reasons for opposing gays. Being perceived as macho matters more in an African context than it does today in the West. Fearing to be seen as favoring unmanly behavior is deadly for a politician.

This fear may also reflect inner insecurities among African men more generally, and some defensiveness regarding HIV/AIDS.

Whatever the deeper reasons for this new legislative intolerance, Africa and the West are in this respect receding from each other rapidly and decisively.

Uganda is the latest African nation to ban homosexual acts and practices. Last month President Yoweri Museveni finally signed a bill earlier passed overwhelmingly by Uganda’s parliament that calls for first-time offenders to be sentenced to 14 years in jail. It also sets life imprisonment as the maximum penalty for a category of offences called “aggravated homosexuality,” defined as repeated gay sex between consenting adults as well as acts involving a minor, a disabled person, or where one partner is infected with HIV.

It is also an offence under the new bill for someone aware of homosexual activity to fail to report it.

Homosexuality, as such, has long been illegal in Uganda and 37 other sub-Saharan African nations. But few people have been jailed or bothered. Now, especially after 500 “homosexuals” were cruelly outed in a local Ugandan newspaper, open displays of affection between men, and between women, have become positively dangerous.“Top Homos in Uganda Named,” said the all block capitals, bold headlines in a flamboyant tabloid. It provided photos, names, addresses, work places, friends, and more for both men and women.

Fundamentalist pastors (backed by several American colleagues) and their parliamentary allies have long claimed that they needed to protect minors in Uganda from being preyed upon by foreign “recruiters.”

Uganda, suddenly very conservative, has also passed anti-pornography legislation that specifically prohibits “indecent” dressing – now interpreted as the wearing of mini-skirts. Some women have since been undressed publicly for wearing skirts above the knee, and women marched through Kampala, the country’s capital, protesting the law. They held posters such as “Thou Shalt Not Touch My Mini-Skirt” and “Don’t Sexualize My Body.”

Women, said one of the protesters to the media, are now “really at risk” in Uganda.

In December, President Goodluck Jonathan signed legislation banning homosexuality in Nigeria. The Same Sex Marriage Prohibition Act criminalizes gay marriage and civil unions, imposing punishment of up to 14 years in prison for gay couples who openly display their relationship. Last month, scores of alleged homosexuals were arrested in different parts of Nigeria. Dozens were taken into custody in the country’s Muslim north, where the practice of homosexuality is punishable by death, especially in those states where sharia law prevails.

In Bauchi State alone, in Nigeria’s Middle Belt between north and south, in January the police arrested several gays and tortured them into divulging the names of others. Authorities have since drawn up a list of 168 men, 38 of whom are already in custody.

Even before parliament approved and Mr. Jonathan signed the legislation, sodomy was illegal. But now there are very much stricter measures against legally recognized gay relationships, public displays of affection between people of the same sex, and – significantly – advocacy for gay rights, including sanctions against organizations dedicated to the fight against the spread of HIV/AIDS.

The Ugandan and Nigerian bashing of gays has been widely condemned. The European Union is considering withdrawing all financial assistance to Uganda, which Denmark, Norway, and the Netherlands have done already.

President Obama, calling such legislation odious, has condemned Mr. Museveni’s action and threatened a similar curbing of aid despite the West’s reliance on Uganda’s military assistance in Somalia (against al-Qaeda-linked al-Shabaab), South Sudan (where Uganda is backing the government), and the Central African Republic (where Uganda and the US are chasing the Lord’s Resistance Army).

Prime Minister Stephen Harper, US Secretary of State John Kerry, and Britain’s Foreign Minister William Hague, have all slammed Nigeria’s pursuit of gays. Mr. Kerry said that Nigeria’s law was “inconsistent with Nigeria’s international legal obligations” and undermined the democratic reforms and human rights protections enshrined in its own 1999 Constitution. Mr Kerry labeled Uganda’s actions “atrocious” – an assault on fundamental human rights.

Yet, attacks on homosexuality, especially the male variety, nowadays seem unusually popular in Uganda and Nigeria, where the abusive laws were passed overwhelmingly and have been well-received according to local and international opinion polls. A Pew Research Center survey indeed showed that Nigerians were among the most intolerant of all in Africa, with 98 per cent of respondents agreeing that society should condemn the practice. Similar attitudes, at the 90 percent level, were found in Ghana, Kenya, Senegal, Uganda, and a number of other African nations.

South Africa is the exception. The practice of homosexuality is legal there, thanks to a very liberal constitution and judgments of the nation’s Constitutional Court.

In Zambia, where homosexuality is officially taboo, this week a human rights activist was acquitted in a local court on charges of promoting homosexuality. He had been charged with “soliciting for immoral purposes” after arguing on a local TV show for gay rights, especially if HIV/AIDS were to be combated effectively. Last year, Malawi President Joyce Banda commuted the sentences of two men earlier jailed for outward displays of mutual affection, offences under local law.

These are but small reverses in the tide of anti-homosexual activity that today engulfs Africa. Traditional attitudes of tolerance, common in yesterday’s villages, seem largely subsumed by modernity, by the overtaking of indigenous religion by evangelical fundamentalism and Pentecostalism, and by a popular political pandering to bigotry.

Respect for fundamental human rights is now imperiled in much of Africa

The Christian Science Monitor has assembled a diverse group of Africa bloggers. Our guest bloggers are not employed or directed by the Monitor and the views expressed are the bloggers' own, as is responsibility for the content of their blogs. To contact us about a blogger, click here.