Britain’s energy regulator has been fighting to keep secret the claims of two whistleblowers who independently raised concerns about potentially serious irregularities in projects worth billions of pounds, the Guardian can reveal.

The two men say Ofgem threatened them with an obscure but sweeping gagging clause that can lead to criminal prosecutions and possible jail terms for those who defy it.

MPs and the whistleblowing charity Protect fear Ofgem is abusing its position and exploiting a law that was intended to protect UK national security – not a regulator from potential embarrassment.

The Labour MP Peter Kyle said: “Whistleblowers save lives and protect our economy from harm; they should be protected by law, not have it used against them.”

One of the whistleblowers told the Guardian he was “continually threatened ... for trying to tell the truth. For doing my job and uncovering an issue, Ofgem made my life hell.”

He said the regulator had attempted to “scare me witless with threats of imprisonment” and he felt “utterly ashamed” of Ofgem’s behaviour.

Ofgem said it encouraged staff to report suspected wrongdoing and took their concerns seriously.

Both men worked for Ofgem in entirely different areas of the business and were regarded as qualified experts in their respected fields.

One was Greg Pytel, an economist with oversight of the rollout of the £10.9bn smart meter programme, which is due to be completed in 2020.

Smart meters are electronic devices for homes and businesses that measure the use of electricity and gas. They are designed to make billing easier and to help energy companies manage the supply of electricity more efficiently.

The second whistleblower, who has asked to remain anonymous, worked on the renewable heat incentive (RHI), which offers financial rewards to promote the use of new technologies such as green boilers.

The scheme, which started in 2011, has been controversial – and could eventually cost taxpayers £23bn. Both projects are key to the government’s stated aim of making the UK a low-carbon economy.

The two whistleblowers do not know each other and have not been involved in each other’s cases. They say they are only linked by the reaction of Ofgem to their claims.

They found themselves in similar positions after being tasked with scrutinising elements of the two major projects they were working on between 2014 and 2017. Both raised concerns with their managers.

Instead of welcoming their input and investigating their concerns, the men allege they were bullied, treated unfairly and sidelined to such an extent they felt compelled to bring their grievances to an employment tribunal.

The RHI whistleblower claimed he was “continually ignored or threatened.” In both instances, the men say they were told they would not be allowed to reveal to the tribunal, or anyone else, the concerns they had. They say Ofgem warned them that the details were protected by Section 105 of the Utilities Act 2000.

This prohibits the disclosure of certain types of evidence relevant to the energy sector – and it is so restrictive that those who ignore it can be fined or jailed for up to two years.

At an early hearing of Pytel’s case, the tribunal ruled Ofgem was required to disclose his documents about public procurement arrangements for the smart meter programme, citing the Human Rights Act. It said he had the right to freedom of expression without interference from a public authority. But Ofgem has against appealed the decision.

Peter Daly at Bindmans, the legal firm that is acting for Pytel, said: “Ofgem’s position appears to be that anyone who disclosed or reported the content of his whistleblowing would be themselves committing a criminal offence.

“They [Ofgem] are appealing an employment tribunal order to provide disclosure in the proceedings because they say to do so would be a criminal offence. Ofgem’s appeal therefore indicates that in Ofgem’s view this prohibition extends to Ofgem themselves.”

Daly says if Ofgem wins this legal battle, it would “have a corrosive and asphyxiating effect on the rights of whistleblowers in the energy sector and would create a binding precedent.”

A second hearing of the case will take place in October.

The second whistleblower has described the alleged reaction of his managers when faced with the concerns he raised. “Specifically I was told that if I told the truth, my career with Ofgem would be finished.”

Despite the threats, he said, he briefed the National Audit Office – a move that infuriated Ofgem, he claimed.

He said a senior manager “screamed and shouted” at him, and he was then warned his disclosures were a breach of section 105 of the Utilities Act 2000.

The whistleblower says he left Ofgem last year after being “threatened with imprisonment if I shared information about the wrongdoings that I had witnessed”. He has described Ofgem as being “dishonestly secretive”.

Kyle, a member of the business, energy and industrial strategy select committee, said: “Ofgem do have many commercial secrets that are vital to the wellbeing of our nations’ infrastructure, but the power they have to gag whistleblowers is an extreme one and should be used in only extreme circumstances.

“I’m now extremely concerned about the potential abuse of these powers. Parliament might need to look at who has oversight and scrutiny of them and see if the law needs updating.”

Protect, formerly Public Concern at Work, has been helping both of the Ofgem whistleblowers, and has intervened in one of the ongoing legal cases.

The body’s chief executive, Francesca West, said: “The whole of the UK energy market – that’s more than 600,000 workers – are currently being held to ransom over Section 105 of the Utilities Act, and threatened with a prison sentence if they speak up over wrongdoing. It is utterly shameful.

“Our society needs whistleblowers to speak up, to stop harm. But we also need organisations to be honest, open and operate legally.”

Ofgem said it had only had to consider the use of section 105 once in the last five years.

“In carrying out our duties as the energy regulator, Ofgem handles large amount of information from consumers and businesses which is often both personal in nature and commercially sensitive.

“With the exception of a few prescribed circumstances, section 105 of the Utilities Act 2000 prohibits the disclosure of the information we receive. Section 105 is intended to ensure that consumers and businesses can share their information without fear that it may be subsequently disclosed. Ofgem takes our obligations under law very seriously, including the restrictions in section 105.

“Ofgem adheres to its whistleblowing policy which encourages staff to report suspected wrongdoing as soon as possible, in the knowledge that their concerns will be taken seriously and investigated.”