David Kelbie's name is inextricably linked with what became known as the Orkney child abuse scandal. Allegations of abuse on the island of South Ronaldsay 10 years ago precipitated a chain of events which led to a public inquiry costing #6m and involving many of the country's leading lawyers.

As a sheriff at Aberdeen it fell to David Kelbie to give a ruling at a proof hearing on the allegations. He threw them out, saying that

the children were in more danger from repeated cross examination designed to break them down and admit to having been abused.

Orkney social work department, which had removed nine children to the mainland, chartered a plane that night and returned them to their families.

Sheriff Kelbie's ruling led to him being hailed as a hero by the parents who had been accused by social workers of abuse. However, a subsequent appeal by the children's panel reporter was successful. Lord Hope, the then Lord President, found that Sheriff Kelbie had breached the laws of natural justice.

Within days the then Scottish Secretary, Ian Lang, ordered a judicial inquiry. Court of Session judge Lord Clyde, in his findings, said that social workers and police had acted precipitately and failed to take time to think. He stressed that the parents of the nine children had to be presumed innocent.

After the inquiry findings had been published Sheriff Kelbie admitted that he deliberately bent the law in order to get the children home.

''It was absolutely plain to me that these children were suffering a grave injustice, and to do nothing would have been to remain a party to that injustice,'' he said. ''The law at that stage required to be bent. If it took someone's head to go on the block to stop what was happening, mine was as good as any. Maybe you can take the risk of being wrong in law on the very odd occasion, if you are going to be right in human terms.''

In the appeal stemming from that decision Lord Hope commented that it was no excuse for a judge to put his conscience above the law.

Sheriff Kelbie comforted himself with the view that the Clyde inquiry report, with its scathing condemnation of the behaviour of social workers, demonstrated how right he had been to avoid applying the strict letter of the law.

Earlier, as a sheriff at Dumbarton, he hit the headlines when he confessed to a sneaking admiration for protesters appearing before him on charges arising from a demonstration at the Clyde submarine base. Michael Ancram, then chairman of the Scottish Conservatives, called for an investigation by the Lord President, saying that such comments were inappropriate while hearing a delicate and difficult case.

Sheriff Kelbie, who was a native of Inverurie in Aberdeenshire, graduated in law from Aberdeen University. He became an advocate in 1968 and was a part-time lecturer at Heriot-Watt University in Edinburgh from 1971 to 1975. He served as a sheriff in North Strathclyde from 1979to 1986 before moving to Aberdeen.

Away from the law, he was for eight years secretary of the Scottish Congregational College and a member of the Scottish and the UK/Ireland committees for Christian Aid. He was also a former editor of the Scottish Civil Law Reports.

He is survived by his wife, Helen, a daughter Catriona, and a son Alasdair.

David Kelbie, Sheriff of Grampian, Highlands, and Islands; born February 22, 1945, died May 30, 2001.