A Catholic adoption society has won a High Court battle over laws forcing it to consider gay couples as parents.
Leeds-based Catholic Care had warned it would be forced to give up its work finding homes for children if it had to comply with the legislation.
Its plea to be allowed an exemption was opposed by the Charity Commission.
However, Mr Justice Briggs has allowed Catholic Care's appeal and ordered the commission to reconsider the case in the light of his judgement.
The High Court ruling was met with dismay by gay rights charity Stonewall.
Jonathan Finney, head of external affairs at Stonewall, said: "It's unthinkable that anyone engaged in delivering any kind of public or publicly funded service should be given licence to pick and choose service users on the basis of individual prejudice.
"It's clearly in the best interests of children in care to encourage as wide a pool of potential adopters as possible."
Catholic Care, which serves the dioceses of Leeds, Middlesbrough, and Hallam in South Yorkshire, argued that the Equality Act 2006 went against the Catholic Church's teachings on marriage and family life.
Other Catholic adoption agencies in England and Wales have changed their policies or closed.
However, Glasgow's St Margaret's Children and Family Care Society changed the wording of its constitution to reflect its Catholic nature and continues to disqualify gay couples from adoption.
The appeal came after the Church lost a battle against the introduction of the Sexual Orientations Regulations, under the Equality Act, which forced agencies to consider homosexual couples as potential adoptive parents.
Catholic agencies were given a 21-month transition period to comply with the new rules, which ended in December 2008.
The Bishop of Leeds, the Right Reverend Arthur Roche, welcomed the judge's decision, saying it would "help in our determination to continue to provide this invaluable service to benefit children, families and communities".
'Security and love'
He said the judgment confirmed that Catholic Care was correct in its reading of the law and that the exemption could apply "to any charity subject to it being in the public interest".
The bishop said: "We look forward to producing evidence to the Charity Commission to support the position that we have consistently taken through this process: that without being able to use this exemption, children without families would be seriously disadvantaged.
"Catholic Care has been providing specialist adoption services for over 100 years.
"We have helped hundreds of children through the recruitment, assessment, training and support for prospective adoptive parents, as well as offering ongoing and post-adoption support to families that give such security and love for some of the most vulnerable children in our society.
"The judgment today will help in our determination to continue to provide this invaluable service to benefit children, families and communities."