NAIROBI — Binyavanga Wainaina has a hangover. Last night friends gathered for his birthday party, which turned into a coming out party, because Wainaina, one of Africa’s most powerful modern literary voices, had just published an article entitled, “I am a homosexual, Mum.”

On a continent where secrecy defines the gay experience and where a majority of countries outlaw homosexuality, coming out is a rare step for a public figure. Wainana’s piece, first published on Saturday, is being shared widely across social networks. “My dear @BinyavangaW writes a piece that springs open the prison doors of the heart,” tweeted Nigerian-born writer Teju Cole.

The timing of Wainaina’s coming out was a mixture of the personal and the political, and anything but accidental.

“Of course my friends knew, but I had been toying with how useful it would be to make a public statement for close to eight months,” Wainaina told GlobalPost on Monday, as his declaration of homosexuality picked up traffic on Africa Is A Country and Chimurenga Chronic, the two African websites where it was first published.

Last year Wainaina — perhaps best known abroad as the author of the satirical essay "How to Write About Africa" — returned home to live in Kenya after a prolonged period of international nomadism and began to feel “a certain falsity in the way I lived my life,” he said.

Wainaina struggled with the relative ease of being clandestinely gay while surrounded by his artist friends in cosmopolitan Nairobi, while elsewhere in Africa homosexuals faced increasing oppression.

Last month he went to a close gay friend’s memorial in the western town of Kisumu and learned that the friend's Christian family had been rejected by the church due to their son’s sexual orientation. Yet the young man’s parents had accepted their son’s homosexuality and even welcomed “half the queens in Kisumu” into their home to celebrate his life, Wainaina said.

Added to that were oppressive new anti-gay laws in Uganda and Nigeria. Ugandan parliamentarians passed a law in late December making “aggravated homosexuality” punishable by life imprisonment. An early draft proposed the death sentence. Nigeria’s president last week signed a law imposing 14-year jail terms for homosexual acts.

“There was the anti-gay bill in Uganda first, but the Nigeria one! Nigeria is a country I go to — I was there three times last year — it is a place I love, it’s like a second home to me,” said Wainaina.

“It’s hard to imagine any more repressive law of any kind anywhere in the world. It’s just the most terrible thing,” he said.

And yet Wainaina does not believe the war for gay rights is being lost in Africa, even if some battles are.

“It seems like doom and gloom but my feeling is that the law is a reaction to a thing that they know has traction,” he said. “And that’s a good thing. There’s no way to put that shit back in the box.”

Wainaina has little time for the trite argument that homosexuality is “un-African.”

“The idea that there is no such thing as gay in African culture is a mixture of an inherited Victorian puritanism via the first churches, mixed with sloganeering and fear,” he said.

Wainaina had been mulling his coming out for the better part of 2013. He said that on New Year’s Day this year he was “one tweet away from just saying it.” Instead, he chose to write his coming out in a short essay styled as a “lost chapter” from his 2011 memoir "One Day I Will Write About This Place," which won a coveted recommendation from Oprah Winfrey.

He wrote the essay during a couple of feverish late-night hours on the eve of his 43rd birthday, Jan. 18. “I was very giddy the whole time writing it, very happy,” he said.

The result is heartfelt, raw and honest.

“Nobody, nobody, ever in my life has heard this,” Wainaina writes. “Never, mum. I did not trust you, mum. And. I. Pulled air hard and balled it down into my navel, and let it out slow and firm, clean and without bumps out of my mouth, loud and clear over a shoulder, into her ear. ‘I am a homosexual, mum.’”

Openly declaring his sexual orientation is both brave and potentially powerful, given Wainana’s reach. He has taught at Bard College in New York State, was awarded the 2002 Caine Prize for African Writing, and won acclaim for his brilliant "How To Write About Africa.” His smart brevity has earned Wainaina a growing Twitter following, and last year Foreign Policy included him in its annual Twitterati 100.

Wainana believes his honesty will be embraced in his home and in other African countries. “People who live in societies where you are being lied to a lot value truth,” he said.

Wainaina is set to become a still-louder voice for gay rights, a struggle that he sees as part of a wider defiance, an effort to break apart “the very, very hardwired restrictions that were imposed in 1885” by colonialists and which “are very alive in every facet of African life.”

“I want to be part of a generation of people in Kenya and Africa who change [Africa] to be accountable to itself,” he said.