CAIRO - While many of their compatriots savor a new political era, gays in Egypt and Tunisia aren't sharing the joy, according to activists who wonder whether the two revolutions could make things worse for an already marginalized community.

In both countries, gays and their allies worry that conservative Islamists, whose credo includes firm condemnation of homosexuality, could increase their influence in elections later this year.

"Our struggle goes on - it gets more and more difficult," Tunisian gay-rights and HIV/AIDS activist Hassen Hanini wrote to the Associated Press in an e-mail. "The Tunisian gay community is still seeking its place in society in this new political environment."

In much of the world, the push for gay rights has advanced inexorably in recent years. Countries that now allow same-sex marriage range from Portugal to South Africa to Argentina.

Throughout the Arab world, however, homosexual conduct remains taboo; it is punishable by floggings, long prison terms, and, in some cases, execution in religiously conservative Saudi Arabia, and by up to three years imprisonment in relatively secular Tunisia. Iraq and Yemen each had a surge of killings of gays two years ago.

In Egypt, consensual same-sex relations are not prohibited as such, but other laws - those prohibiting "debauchery" or "shameless public acts" - have been used to imprison gay men.

Ten years ago, Egypt attracted worldwide attention - including criticism from international human-rights groups - when 52 men were arrested in a police raid on a Nile boat restaurant/disco and accused of taking part in a gay sex party. After a highly publicized trial in an emergency state security court, 23 of the men were convicted and sentenced to prison terms of one to five years for immoral behavior and contempt of religion.

In 2008, four HIV-positive Egyptians were sentenced to three years in prison after being convicted of the "habitual practice of debauchery." Human-rights groups warned the case could undermine HIV/AIDS prevention efforts in Egypt.

Human Rights Watch - which monitors discrimination against gays as part of wide-ranging global activities - says there are no groups in Egypt specifically identified as gay-rights advocates.

"There's been no movement on this issue in Egypt since the revolution, nor is there likely to be any improvement in the short term," said Heba Morayef, the main Egypt researcher for Human Rights Watch.

Some of the void in advocacy is filled by the Egyptian Initiative for Personal Rights, which in a decade of existence has defended people entangled in various antigay prosecutions as part of its civil-liberties agenda.

The group's executive director, Hossam Bahgat, said the once-common use of entrapment to arrest gays had subsided in recent years. But he said antigay debauchery trials still take place occasionally.

In the short term, Bahgat was skeptical that any Western-style gay-rights movement could take hold in Egypt, despite the sense of liberation after the February ouster of Hosni Mubarak.

"The challenge is to ensure that what emerges from the transition isn't just a democratic government, but also a democratic society," Bahgat said, referring to the quest for equitable treatment of women, religious minorities, and gays.

In the long term, Bahgat said he was cautiously optimistic because Egyptians under 30 - a majority of the population - seem more open than their elders to the concept of a diverse Egypt.

Notable among the young Egyptians trying to change attitudes toward gays is Mostafa Fathi, 28, the editor in chief at a Cairo Internet radio station. Two years ago, he published a book, In the World of Boys, which he says is the first Egyptian novel depicting a gay central character empathetically.

The book stirred controversy, and Fathi said some government officials made known their displeasure. But it was not banned, and Fathi said copies were still available.

"In my book, I have a character who says, 'I am a gay. You have to respect me,' " Fathi said. "We all should respect everyone. It's not good to judge people as evil."