DAKAR (Reuters) - It took less than a minute for a panel of judges in Senegal to sentence seven men to six months in prison for homosexuality last week, but campaigners say the harm to the African nation's anti-HIV efforts could last much longer.

Senegal, a Muslim country regarded as a pillar of democracy in turbulent West Africa, is one of about 30 African states with anti-homosexuality laws. Yet the country of 14 million people also prides itself on its vigorous, and successful, anti-HIV efforts.

Campaigners warned that Friday's verdict, based on a police discovery of condoms and lubricant in the house where the men were arrested, was a hammer blow to groups promoting safe sex.

Gay men's preventative efforts could now transform them into targets for authorities, campaigners said.

"We are prevented from carrying condoms. We are prevented from carrying lube," said Djamil Bangoura, president of Prudence Association, an organization promoting rights for lesbians, gay men, bisexuals and transsexuals (LGBT). "That's what I understood from the (trial)."

A police spokesperson could not be reached for comment.

On a 2013 visit to Senegal, U.S. President Barack Obama called for steps to make homosexuals equal before the law in Africa. President Macky Sall replied that gays were not persecuted in Senegal but that his country was not ready to decriminalize homosexuality.

Senegalese law prescribes up to five years in prison and a 1,500,000 CFA fine ($2,587) for homosexuality, says the International Lesbian, Gay, Bisexual, Trans and Intersex Association’s 2015 report.

Its anti-homosexuality laws are not as severe as others in West Africa. In certain parts of Nigeria, being gay is punishable by death, while Gambia recently passed a law making 'aggravated homosexuality' - sex with minors or if you are HIV positive - punishable with life in prison.

But Neela Ghoshal, senior researcher for Human Rights Watch on LGBTI issues, said Senegal was one of a handful of countries that regularly prosecuted individuals under these laws.

"There is a disconnect between what is needed in terms of public health policy and what the government is willing to accept in terms of decriminalization," she said.

'SEX IS TABOO'

Senegal launched its national AIDS program in 1987, just a year after the country's first case was documented. It has since been one of the most successful nations in Africa at stemming the spread of the disease: UNAIDS estimated in 2014 that just 0.5 percent of 15 to 49 year-olds in Senegal had HIV – a fraction of the continent-wide average of 4.8 percent.

But HIV prevention among the LGBT community has long been contentious. In 2008, days after Senegal hosted the International Conference on AIDS and Sexually Transmitted Infections, anti-HIV campaigners were briefly arrested on homosexuality charges, Human Rights Watch said.

In Senegal, as globally, gay men are impacted by HIV at a much higher rate than the general population.

In July, the Ministry of Health issued a report saying the HIV rate among gay men in 2014 was edging lower from previous years but was still 17.8 percent.

Worryingly, the report highlighted that among 18- and 19-year-old gay men, the rate had skyrocketed to nearly 20 percent from just 5.2 percent in 2007.

Dr. Abdoulaye Wade, head of the Ministry of Health’s HIV Division, said the figures may have been distorted by more young people responding than in prior years.

But Julo, the secretary for AIDES Senegal, an association focused on LGBT rights and AIDS, said young people are ill-informed about safe sex.

"Sex is very taboo in Senegal," said Julo, who asked only to be identified by his middle name.

A doctor at the Division’s HIV office who asked to be identified only as Diop, his last name, agreed: "When people have these diseases, we call them diseases of shame."

For AIDES Senegal, decriminalization was not its main goal but reducing private discrimination in areas such as housing, employment and health.

Several people working closely with gay rights associations pointed to the influence of religion: many religious leaders say homosexuality is forbidden in the Koran.

"I would hope that ultimately, the government is able to stand up to religious leaders on these issues, because honestly the government knows better," said Ghoshal.

(Reporting by Makini Brice; Editing by Daniel Flynn and Gareth Jones)