A Catholic adoption agency has been told it can keep its charitable status.
The Scottish Charity regulator had previously informed St Margaret's Children and Family Care that it was to lose its status because of its refusal to place children with same-sex couples.
This decision came after the charity - which is run by the Catholic Church in Scotland - was investigated by the Office of the Scottish Charity Regulator over a complaint made by the National Secular Society that its practices breached the Equality Act 2010.
However, the Glasgow-based charity has won an appeal against the decision to remove its charitable status after the Scottish Charity Appeals Panel found in its favour following a review.
St Margaret's - run by the Catholic Church in Scotland - said it was "delighted and relieved" by the ruling.
The decision was also welcomed by Catholic Archbishop and President of St Margaret's Philip Tartaglia, who said in the BBC that its closure would have been a "pity".
"We are grateful for this wise decision. It means that families who are ready to adopt can look forward to the future with a little more serenity, and children in great need can be placed into loving homes," he said.
"St Margaret's is a small agency which does great work for the wider community and helps transform the lives of some of the most vulnerable children in society. It would have been have been a great pity if it had been forced to close."