West Yorkshire Police were guilty of sex discrimination in refusing to recruit a male-to-female transsexual, law lords have ruled.
The five law lords ruled unanimously that the woman, Miss A, was unlawfully discriminated against in breach of the Sex Discrimination Act.
They upheld a decision by the Court of Appeal last November.
West Yorkshire Police had argued that Miss A would not be able to carry out certain duties, such as body searches.
Lord Bingham said that, under European law, transsexuals were entitled to the same protection against discrimination as any other individual and to be recognised as belonging to their "acquired gender".
Nobody searched by a post-operative transsexual police officer who was, visually and for all practical purposes, of the same gender could reasonably object to the search, he said.
Lords Steyn, Rodger and Carswell and Baroness Hale agreed in dismissing the police appeal.
As a result, Miss A is entitled to compensation for discrimination dating back to September 1999, when an employment tribunal found in her favour.
Miss A underwent sex change surgery in 1996 and now has no outward male characteristics.
She successfully completed a police assessment course, but her application to join the West Yorkshire force was rejected in 1998.
She was told that the force operated a blanket ban on transsexuals because there were difficulties when they were asked to carry out intimate body searches and therefore could never be fully operational.
In 1999, an employment tribunal upheld Miss A's complaint of sexual discrimination, ruling that if she was accepted as a woman, "nobody would be any the wiser".
Later the same year, the Employment Appeal Tribunal found that, although it was discrimination, it was not unlawful because the woman was legally a male and could not be asked to carry out searches on women.
But the Court of Appeal held that Miss A's willingness to disclose her transsexuality to colleagues or members of the public with whom she had to deal destroyed the chief constable's defence that she would be unable to comply with rules governing body searches.
After the hearing, chief constable Colin Cramphorn said in a statement that he was pleased the judgement had finally brought the matter to a close.
"The Gender Recognition Bill, which becomes law this summer, will finally, directly rectify the law West Yorkshire Police was constrained by, when A applied to join in 1997," he said.
"West Yorkshire Police remains committed to equal opportunities for all potential employees.
"We employ non-police transgender staff, as we did at the time of A's application."