The research found 67% of legal professionals believed “being in the right social network” influenced who became a sheriff or a judge, although almost no-one thought it should.

The suspicion was most commonly held by solicitors, women and younger members of the profession, rather than advocates, solicitor-advocates or members of the judiciary themselves.

The study was commissioned by the Judicial Appointments Board for Scotland, the body which sifts applications for the bench.

The work was undertaken shortly after a Sunday Herald investigation last year revealed that most of Scotland’s 35 judges are white, male, privately educated, and live and socialise alongside one another in the capital.

Appointments to the bench should always be made on merit.

The survey by the MVA Consultancy was designed to find out the make-up of those currently working in law, and whether perceptions about the bench were deterring suitable candidates.

It was sent to all solicitors, advocates, sheriffs and judges in Scotland, and received 2319 responses, or 19% of the profession.

Although largely positive, the survey found “further progress” was needed to ensure those applying for the bench were representative of the pool of talent available.

One unhappy respondent said: “The current perception in the profession is that to obtain judicial office, the candidate must move

in ‘the right’ social circles, have political connections, and an appropriate middle-class background.

“It seems that ability and knowledge are lesser considerations.” Another said people who “ought to be nowhere near the bench” were getting appointed largely because they sat on legal committees.

A third said the problem was particularly acute in the appointment of sheriffs.

“There is a strong belief that... appointments are not being made on merit.

“It is extremely difficult to see a number of... appointments as anything other than an exercise in quota filling.”

Knowing the right people was seen as one of the three most important factors in promotion, alongside having good references and being known by the judiciary.

However, of these, only good references were seen as deserving to have a positive influence, with 94% of people saying that being in the right social networks ought to have no

influence at all.

Sir Muir Russell, chair of the Judicial Appointments Board, welcomed the report, saying it would be taken into account “when considering whether there are ways of further encouraging diversity among those available to be selected for judicial office in Scotland”.

Lord Hamilton, the Lord President, Scotland’s most senior judge, said: “It is of the first importance that individuals appointed to judicial office are of the highest calibre.

“Selection for appointment must be solely on merit but it is

essential that applications should be encouraged from the widest range of persons eligible.”

Richard Keen QC, Dean of the Faculty of Advocates, added: “It is particularly important that we have a process which provides for appointments throughout the system without regard to gender, ethnic background, marital status, sexual orientation, political affiliation, religion or disability.”