A top judge and staunch opponent of a register of interests for the judiciary has shareholdings in several investment funds.

Lord Gill, who has been critical of plans to require judges to publish their financial interests, made the declaration in his capacity as a board member of a courts quango.

It can also be revealed that his predecessor as Lord President, Lord Hamilton, declared shares in dozens of companies when he was in post.

In a written submission to the Scottish Parliament's public petitions committee, Lord Gill argued that a register of interests for judges and sheriffs was unnecessary, adding that their privacy could be impacted by "aggressive media or hostile individuals".

He wrote: "The establishment of such a register therefore may have the unintended consequence of eroding public confidence in the judiciary."

The Lord President declined Parliament's invitation to elaborate on his argument in person, a snub he was within his rights to deliver as judges cannot be compelled by law to give oral evidence to Holyrood. The Lord President instead agreed to a private meeting with MSPs.

However, despite his hostility to a register, Lord Gill is required as a Scottish Court Service (SCS) board member to declare shareholdings and membership of outside bodies. Other board members include Lord Justice Clerk Lord Carloway, Sheriff Principal Dunlop, Lord Bannatyne and sheriffs Iona McDonald and Grant McCulloch.

These registers have recently been made available to the Sunday Herald. Lord Gill, the de facto leader of Scotland's judges, declared shares in Henderson UK Growth Fund, Newton International Growth Fund, Aviva Investors UK Equity Fund, Terrace Hill Group and Vestry Court Ltd.

Sheriff McDonald declared shares in seven companies: pharmaceutical giant GlaxoSmithKline, banks HBOS and Barclays, Royal Dutch Shell, Standard Life, Unilever and Equiniti.

Lord Hamilton, who was Lord President until two years ago, registered shares in 33 firms in 2011. These included Barclays, BSkyB, BP, Centrica, Nestle SA and Rio Tinto.

Also listed were shares in Statoil ASA, National Grid, HSBC bank and Edinburgh Dragon Trust.

The declarations have raised the question of why, if Lord Gill and other senior colleagues can register financial interests as SCS board members, all judges and sheriffs cannot do the same.

However, in a letter to the Committee, Lord Gill said the SCS entries were an "entirely different" matter. "The requirement of those judicial office holders who are members of the SCS to register their interests arises in the context of their membership of a public body," he said. "The disclosure of their interests arises from their work as board members, which may involve the placing of contracts and employment questions. It is not related to their holding judicial office."

Chic Brodie, an SNP MSP, said: "This shows there is no consistency. There should be a consistent set of rules across the judiciary."

A spokesperson for the Judicial Office for Scotland declined to comment beyond Lord Gill's letter.