Thoko Chikondi/The Associated Press

ACCRA, Ghana — The endorsement of marriage rights for same-sex couples by Barack Obama, the African-descended president of the United States, has struck some observers as a political calculation, others as courageous and some here in Africa as outrageous.

But might Mr. Obama’s words have also inspired an African head of state to change her country’s course?

Maybe.

Just nine days after Mr. Obama’s announcement that he supports same-sex marriage rights, Malawi’s new president, Joyce Banda, denounced the continued persecution of gays and lesbians in her country.

“Indecency and unnatural acts laws shall be repealed,” Mrs. Banda said in her first state-of-the-nation speech on Friday, according to The Associated Press.

There are certainly other motivations pushing Mrs. Banda to support gay equality. In her address, for instance, she noted that her government seeks to normalize relations with “our traditional development partners who were uncomfortable with our bad laws.”

Malawi is a small country, with up to 60 percent of its 15.4 million people living below the poverty line. So when Prime Minister David Cameron of Britain recently threatened to cut off aid to countries that violate the civil rights of gays and lesbians, it likely resonated with Mrs. Banda.

One of her very first acts was to devalue the currency by a third to appease the International Monetary Fund and restore funding.

Standing up for sexual minorities and publicly attempting to decriminalize homosexuality hasn’t been a priority of the current crop of elected African leaders.

Last summer, after increased visibility and vilification of Ghana’s gays and lesbians, President John Atta Mills proudly rejected Mr. Cameron’s call for decriminalization, to the cheers of many here.

Mr. Mills said, “I, as president, will never initiate or support any attempt to legalize homosexuality in Ghana.”

And even in South Africa, a beacon of gay rights internationally, activists are fighting a proposal from the House of Traditional Leaders to remove the term “sexual orientation” from section 9(3) of the South African Constitution, which prohibits discrimination against myriad categories of citizens.

Rodger Bosch/Agence France-Presse — Getty Images

So Mrs. Banda, 62, a mother of two, is bucking a trend. And the reaction to her proposals will be interesting. African culture generally demands respect for elders and mothers, so rebukes may not be easily forthcoming.

Still, it will take an act of Parliament to change those “bad laws,” and whether she can convince lawmakers to do so is an open question.

Two years ago, Malawi made international headlines when two men were sentenced to 14 years in prison for celebrating their union. That ruling was widely condemned by Western nations and international organizations — including donors. Mrs. Banda’s predecessor ultimately pardoned the couple.

Then-President Bingu wa Mutharika, nonetheless, declared they had “committed a crime against our culture, against our religion, and against our laws.”

Mrs. Banda’s is not an isolated voice, however. Last year, Botswana’s former president Festus Mogae, who championed providing H.I.V. medication to all who needed it, joined an African elder statesman, Kenneth Kaunda, a former Zambian president, to urge decriminalization of homosexuality.

They went to Lilongwe, Malawi’s capital, in June 2011 as part of their campaign to reduce H.I.V. transmission. “We can preach about behavioral change, but as long as we confine gays and lesbians into dark corners because of our inflexibility to accommodate them, the battle on H.I.V. and AIDS can never be won,” Mr. Mogae said.

He admitted to the BBC that he hadn’t risked losing an election by trumpeting gay rights during his years in office, from 1998 to 2008, but he said he had never sought to arrest gays either.

Mr. Kaunda, who was in office from 1964 to 1991, said, “We are not only condemning African leaders who are criminalizing same-sex marriage, but we are urging them to start recognizing these people, for the sake of H.I.V. and AIDS.”

Mrs. Banda is the first African leader to respond with action. She was Mr. Mutharika’s vice president when he died in office in April. She stepped in to serve out his term, which ends in 2014.

In Ghana, Mr. Obama’s words were soothing to the small but vocal community of gay rights activists. And around the continent, and in the West, gay and lesbian Africans are increasingly tossing off the veil to proclaim their right to exist.