When I read a draft of his trenchant memoir, “My First Coup d’État,” in 2010, I offered to introduce him to some agents and editors in New York. Many people in the developed world expect African heads of state to be either terse and political or bloated and ideological.
 
The surprise of John Mahama’s book is its tender humanism, and I thought it would go a long way toward breaking down prejudice in the United States.
 
I blurbed the book when it was published last July; I hosted a party to celebrate its publication; I conducted an onstage interview with John Mahama at the New York Public Library and I am thanked in the book’s acknowledgments.
 
Soon after, the Ghanaian president, John Atta Mills, died and John Mahama stepped into the presidency; in December, he was elected to another term. Two weeks ago, the Ghanaian press suddenly exploded with references to Mr. Mahama’s relationship with me.
 
“President John Dramani Mahama has been fingered to be in bed with one Mr. Andrew Solomon, a gay lobbyist,” blared one unfortunately worded report. Another announced, “Andrew Solomon reportedly gathered a few affluent people from the gay community to raise campaign funds for President Mahama with the understanding that when President Mahama won the elections, the president would push the gay rights agenda.” I was reported to have paid $20,000 for copies of the book.
 
The occasion of these revelations was Mr. Mahama’s appointment of what one newspaper called the “fiery human and gay rights advocate, Nana Oye Lithur” to head the newly established Ministry of Gender, Children and Social Protection.
 
In confirmation hearings before a parliamentary committee, Ms. Lithur averred that “the rights of everybody, including homosexuals, should be protected,” thus invoking a firestorm. I was presumed to have pushed through her nomination, even though I had in fact never heard of her.
 
The argument that Ms. Lithur was selected not for her formidable skills, but because of a foreign devil fit with the continuing position among some Africans that homosexuality is an import from the decadent West.
 
I have neither the ability nor the inclination to meddle in foreign elections, and I paid not one red cent for the book John Mahama inscribed to me. The only way I may have influenced him on gay rights was by welcoming him into the household of a joyful family with two dads. It is deeply unsettling to be implicated in a national scandal, to know that my attempts to be kind and helpful to someone would become his millstone.
 
On Friday, Feb. 1, the president’s spokesman said that President Mahama didn’t know me. On Saturday, the president called me to apologize. On Sunday, the government issued a statement that Mr. Mahama and I know each other, that I have never made a campaign contribution or persuaded anyone else to do so, and that President Mahama “does not subscribe to homosexualism and will not take any step to promote homosexualism in Ghana.” I am not sure what is involved in promoting homosexualism, but I am pleased to know that a cordial friendship with me does not constitute such an act.
 
The situation of gay people in most of Africa is deplorable, and the double talk from the Ghanaian administration has done little to assuage valid concerns. In the wake of this brouhaha, I have received hundreds of letters from Ghanaians via my Web site and Facebook. Half are from gay people about how dire their situation is. One said, “I am tired of this humiliation and embarrassment. I don’t know whether I am a gay. I am not a living being. I have tried to pretend to be what they wanted. I need your word of advice and help. Sorry to say I feel like committing suicide. My tears are dropping so badly that I have to end my e-mail here.”
 
But the other half are from straight allies, of whom there appear to be legions. One woman complained, “Men are deceiving me too much, so I want to join your LGBT please.” My favorite was, “I wish God has blessed me like you. I am not a gay but I respect and love so so much. May you live to always help mankind.”
 
By curious coincidence, this whole matter has unfolded while I am in India promoting a book that deals in large part with how any condition may go from being perceived as an illness to being lived as an identity.
 
It draws on my experience of such a transition for gay people in the United States. When I first visited India, some 20 years ago, the only clearly gay people were destitute and marginalized. On my second trip, in the late 1990s, I met a subculture of rather soigné gay people, but their faces flushed whenever the thing we had in common was acknowledged.
 
At the Jaipur Literature Festival last month, the “gay panel” attracted more than a thousand people who complained of the hideous prejudice they faced in India — but who were emboldened to object publicly to the problem in a tone that anticipated its ultimate resolution.
 
In Ghana, the articles that attacked President Mahama for knowing me referenced “the raging national debate on gay and lesbian rights” in Ghana. That there is such a debate — even if it’s a debate about whether to lynch us — is meaningful progress.
 
The fact that local propagandists can plausibly suggest that the president of a West African country is in the hands of gay lobbyists reflects a changing world. I hope that President Mahama will seize this occasion to take a leadership role in the region on L.G.B.T. rights.
 
 The fact that so many people from his country wrote to me when the scandal broke indicates that many are thinking through these issues. I hope the time is not far off when to know someone like me will be less of a liability and more of an asset.
 
Andrew Solomon is the author, most recently, of “Far From the Tree: Parents, Children, and the Search for Identity.”