Ugandan Justice Stella Arach yesterday issued a ruling in favour of LGBT activists in their suit against the Attorney General of Uganda.
The Uganda Hight Court ruling cited constitutional violations of the rights to privacy, property and the fundamental rights of women.
It was the first time a gay or lesbian person has brought the authorities to court.
"This is a profound ruling that will limit police intrusiveness into the private lives of human rights defenders," said Paula Ettelbrick, executive director at the International Gay and Lesbian Human Rights Commission (IGLHRC).
In July 2005 the house of Victor Juliet Mukasa, of Sexual Minorities Uganda (SMUG), was raided in the middle of the night by local government officials who seized documents and other material.
Another lesbian activist, Yvonne Oyoo, a Kenyan student who was in Ms Mukasa's house on the night of the raid, was arrested and detained by local government officials and then taken to a police station.
There she was stripped, supposedly in order to confirm she was a woman, and fondled and sexually harassed by police officers.
After the Ugandan government failed to investigate or take any action to remedy the wrongs that had occurred, Ms Mukasa and Ms Oyo filed a private suit against the Attorney General.
In yesterday's ruling, Justice Arach acknowledged that the government was not directly responsible for the actions of the local official, an elected town councilor, but nevertheless held the Attorney General's office responsible for the actions of the police.
Justice Arach cited the Universal Declaration of Human Rights and the Convention of the Elimination of All forms of Discrimination Against Women (CEDAW) and key human rights treaties that had been violated by the police's actions.
She ordered that Ms Oyoo and Ms Mukasa be paid £4,700 in damages.
"The most important role that police can play is to protect people," said Ms Mukasa.
"This judgement is a serious reminder to the Ugandan police that all Ugandans, including LGBT people, should be handled with respect and dignity."
In 2005 Uganda became the first country in the world to introduce laws banning same-sex marriage.
Section 140 of Uganda's penal code carries a maximum penalty of life imprisonment for homosexual conduct, while Section 141 punishes 'attempts' at carnal knowledge with a maximum of seven years of imprisonment.
Section 143 punishes acts of "gross indecency" with up to five years in prison, while a sodomy conviction carries a penalty of 14 years to life imprisonment.
President of Uganda Kaguta Yoweri Museveni and other officials have spoken out against homosexuals on numerous occasions.
In June this year, Ugandan Bishop Luzinda said:
"I have been hearing that gays are demanding that the government should legalise their activities.
"This is absurd because God created a man and woman so that they can produce and fill this world.
"The government should not be tempted to legalise this backward culture which is bound to destroy this country.
"Not all that comes from Europe is superior and must be taken up by us," Bishop Luzinda said.
Mr Museveni spoke of his country's "rejection" of homosexuality during a speech he gave at the wedding of a former MP's daughter earlier this year.
He said the purpose of life was to create children and that homosexuality was a "negative foreign culture."
During his time in office LGBT Ugandans have been repeatedly threatened, harassed or attacked. Many have fled the country.
IGHRC: Uganda: Victory for Human Rights