Two female social workers found in contempt of court for overriding a sheriff's child contact order have won their appeal at the Court of Session.

The ruling to quash the verdict was greeted with relief by their employers, Edinburgh City Council. A spokesman said the workers had been fully vindicated.

The decision by Sheriff Kathrine Mackie sent shockwaves through the social work profession in December 2013.

The sheriff said that the decision by Carol McCulloch to cease contact and the approval of that decision by her line manager Gillian Lawrence, amounted to contempt.

Ms McCulloch had initially followed the sheriff's order, but after contact resumed it was causing the children such distress that their foster carers told her they were finding it too difficult to manage and they might have to give up caring for them. She subsequently decided to cease contact and asked for a Children's Hearing to consider that decision. Delays then meant the position was unclarified for several months.

However Lord Malcolm, who heard the case with Lord Carloway and Lord McGhie, said : "The sheriff has not made any findings which justify her conclusion that the social workers' conduct was a contemptuous affront to the dignity and authority of the court."

He said they had been mindful of Sheriff Mackie's original ruling and had tried to ensure a children's panel, the appropriate legal authority, reviewed it.

The ruling also included strong sympathy for the difficult positions social workers can find themselves in. Lord Malcolm added: "They were under a professional duty to respond to the position as it developed and as it was reported to them shortly after the resumption of weekly contact, all as graphically described in the evidence of one of the foster carers," and continues: "There will always be room for a reasonable dispute or difference of opinion on such an issue, and the court must be careful to avoid an overly protective attitude towards its own earlier decision.

"The court should also be sensitive to the difficult situation in which these, and no doubt the other social workers involved, were placed... It is not difficult to envisage an alternative scenario in which no effective steps were taken and real and lasting harm was caused to the children, leading to the social workers being the brunt of strident criticism."

Sheriff Kathrine Mackie had imposed no punishment when she found the workers in contempt, but said her finding would be of 'considerable importance' to them and other social workers.

She had instigated the contempt of court hearing herself, having heard that the mother's agent had written to the social work department suggesting their actions may have been in contempt of court. No suchapplication had been made to the court.

Lord Malcom said: "The court does not consider that it is appropriate to proceed in this fashion.

"It ought only to be in exceptional circumstances that a sheriff should act directly to seek to secure enforcement of a final court order... by initiating action himself/herself."

Michelle Miller, Chief Social Work Officer for the City of Edinburgh Council, said: "We are pleased common sense has prevailed. From the outset our experienced child protection managers were motivated to act in the best interests of two vulnerable children."

The past year had been very challenging for the two workers, she said. "I am delighted they have been fully vindicated in the decisions they took, as has the social work profession."

John Stevenson, of Unison's Edinburgh Branch praised the council for backing the workers throughout and said: "The court has recognised complex and difficult decisions social workers have to take in their work in protecting the welfare of children. We hope this decision will assist in providing some clarity for them in exercising their duty in good faith."

Trisha Hall of the Scottish Association of Social Work said: "We are pleased that this ruling suggests that the welfare of children is the primary consideration and that the appeal has recognised the complexity of assessment and decision making which social workers face on a daily basis."