A decision by HM Revenue and Customs not to disclose whether investigations are under way into British surveillance technology company Gamma International has been quashed by the High Court.

A judge ruled the 2013 decision was taken unlawfully and must be reconsidered.

The ruling was a victory for campaign group Privacy International (PI), which alleges Gamma has supplied equipment to "repressive" regimes around the world to spy on political activists, leading to serious breaches of human rights.

PI told HMRC: "At the most serious end of the spectrum, we believe that Gamma's technologies are being used to gather information on individuals who are then arrested, tortured and, in some cases, executed."

The allegations relate to Gamma's FinFisher products for covertly installing malicious software - "malware" - on a user's computer or mobile phone without their knowledge by tricking them into downloading fake updates.

HMRC, which is responsible for enforcing UK export controls, told PI that it had no power or duty to provide information or progress reports about any investigations into was conducting.

PI applied for judicial review on its own behalf and two political activists who say they are victims of criminal surveillance by the security forces of Bahrain and Ethiopia and entitled to know about any investigations, or if none are taking place.

PI lawyers submitted the equipment use by the security agents was supplied by Gamma in breach of export regulations.

The allegations have been denied and G amma has repeatedly stated that it only supplies products and services to legitimate government organisations.

Mr Justice Green, sitting in London, stressed that he had not heard any evidence from Gamma.

He said his judgment dealt only with the powers and duties of HMRC and he was not ruling on the merits of the complaints lodged.

He ruled the decision not to disclose information must be retaken for several reasons, including misdirections and errors of law by HMRC decision makers and their "irrational" failure to obtain advice or guidance from the unit responsible for assessing PI's complaint.

The judge also said "new reasons" had been given for the decision which were inconsistent with those in decision letters.

Giving guidance for a re-hearing, the judge said NGOs like PI " can act as guardians of the public conscience".

He said: "As with the press their very existence and the pressure they bring to bear on particular issues, and upon those who are responsible for governance of those issues, is one of the significant checks and balances in a democratic society. They have, therefore, a significant role to play."

However the nature and extent of information which could be provided to them "may depend on the circumstances of a given case".

The judge said the HMRC had treated as "a sufficient generic reason" to withhold information from PI that it could impact upon the reputations of individuals or companies.

He ruled: "To adopt this stance was unlawful. Even if there is some reputational harm, that still has to be balanced against other interests, including the public interest in transparency and disclosure."