A Roman Catholic adoption agency has been told it cannot turn away gay couples if it wants to keep its charitable status.
Catholic Care, run by the Diocese of Leeds, wanted its adoption service to be made exempt from equality laws.
A judge has ruled the charity had failed to give convincing reasons why it should be allowed to do so.
Catholic Care said it would consider its position but could have to end the service as it would lose funding.
The charity - which has been placing children with adoptive parents for more than 100 years - was among 12 Catholic agencies in England and Wales forced to change their policy towards homosexual people due to equality laws passed in 2007.
Others have since closed or cut their ties with the Church.
Catholic Care had tried to change its constitution so that it would be committed to following Catholic teaching and placing children only with heterosexual parents.
The agency, which serves the dioceses of Leeds, Middlesbrough, and Hallam in South Yorkshire, had argued the Equality Act went against the Catholic Church's teachings on marriage and family life.
The latest ruling by a judge in the Upper Tribunal, which is the equivalent of the High Court in the administrative justice system, follows rejections of the charity's case in the High Court and by the Charity Commission and the Charity Tribunal.
In its judgement, the tribunal said Catholic Care had not provided sufficient evidence that its funding would dry up and it would be forced to close, and some potential adopters would then not come forward.
In a statement, Catholic Care said: "Without the constitutional restriction for which it applied, Catholic Care will be forced to close its adoption service.
"The reason for this is that the service permitted by the current constitution is in conflict with the aims of the charity.
"It is Catholic Care's view that this will reduce the number of adoptive parents available and the number of children left waiting for adoptive parents will continue to increase.
"Catholic Care will now take time to consider the decision in detail and decide on its next steps."