A Canadian court has said that the ban on gay men donating sperm is perfectly legal.

A lesbian woman had claimed that federal regulations that prohibit the use of sperm from any man who has had sex with another man was a breach of her rights.

The woman wanted to use sperm from a gay friend, but a 1977 law prohibits him from donating.

Three judges sitting at Ontario Court of Appeal ruled that the federal law is rational.

“The medical evidence in the record establishes that there is a higher prevalence of HIV and hepatitis among men in the ‘men who have sex with men’ category,” said the court, according to canada.com.

There is a similar ban on men over 40 donating sperm because of the higher risk of mutations.

The 40-year-old lesbian, Susan Doe, already has a daughter using the sperm of her friend, identified in court as D.

On that occasion she inseminated herself and fell pregnant.

After failing to self-inseminate when trying for a second child, she approached a clinic, who informed her of the law regarding gay men’s sperm.

Ms Doe claimed her liberty was being restricted and that as the law does not apply to married couples, she was a victim of discrimination as a lesbian.

“The main objection we had is that they unnecessarily require both D. and Susan Doe to go through a very rigorous regime, in circumstances where other people are not regulated at all,” said Andrew Pinto, a lawyer for D. and the advocacy group Equality for Gays and Lesbians Everywhere, told canada.com.

“People in a known donor situation exercise care and they presumably wouldn’t be choosing somebody who was going to be a risk factor.”

Doe’s lawyers are considering an appeal to the Supreme Court of Canada.