A Roman Catholic adoption agency will have to give up its work if it is forced to consider same-sex couples as parents, a High Court judge has heard.
The Diocese of Leeds' charity Catholic Care is appealing against a Charity Commission ruling stating it cannot discriminate against gay applicants.
The charity says the Equality Act 2006 went against the Catholic Church's teachings on marriage and family life.
Other Catholic adoption agencies have changed their policies or closed.
The appeal comes after the Church lost a battle against the introduction of the Sexual Orientations Regulations, under the Equality Act, which forced agencies to consider gay 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.
Catholic Care, which serves Leeds, Middlesbrough and Hallam in South Yorkshire, had wanted to take advantage of a clause in the act which allows charities to discriminate by amending its charitable objectives.
However, it was barred from doing so by the Charity Commission.
Christopher McCall QC, representing the charity, told Mr Justice Briggs that the discrimination would be justifiable because the good work the charity carried out with children "far outweighed" the harm from denying its services to same-sex couples who would still be able to go to other adoption agencies.
He said: "[The charity] accepts that to carry on as before involves discrimination but says it is merely a justifiable means to a legitimate end, namely that of securing homes for children who could be expected not otherwise to find homes at all."
If not allowed to do so, Mr McCall said, the charity "conceives that it will have to give up its adoption services in their entirety and this will operate to the detriment of the children who would otherwise have found a family".
Mark Wiggin, chief executive of Catholic Care, said: "In effect, we are being invited either to stop our adoption work or stop being a Catholic charity.
"Neither of these options is acceptable to our trustees, our beneficiaries or supporters."
A Charity Commission spokesperson said: "It is inappropriate for us to comment on this case during the hearing."
The High Court hearing is expected to last three days.