About 18 million customers are on some form of default tariff, which can cost hundreds of pounds a year more than the cheapest deals.

However, the price cap is unlikely to take effect before winter.

The cap will last until 2020, and possibly be extended to 2023 if Ofgem decides that is necessary, the government said.

Prime Minister Theresa May said the energy market “has to offer fairer prices for millions of loyal customers who have been paying hundreds of pounds too much”.

Business and Energy Secretary Greg Clark said that customers of the big six energy suppliers were “overpaying to the tune of £1.4bn a year”.

“That is simply wrong,” he said, adding that the draft legislation would send a “clear message to suppliers they must act to put an end to loyal consumers being treated so unfairly”.

However, Steve Smith, director of energy switching firm Flipper and former Ofgem board member, said a cap could push up fixed fees.

“A regulated price means people will switch off and think ‘the government’s looking after me’,” he told the BBC.

He said it was clear that Ofgem was being told to implement the cap by the government, but the cap went against the advice of the Competition and Markets Authority.

“It could actually do harm to competition and means many customers will end up paying a lot more. If two-thirds of the market is covered by a cap you start to question whether it’s a market at all.”

He added that the £1.4bn figure quoted by Mr Clark, which came from the CMA, was “entirely hypothetical” and controversial.

“They talk about this £1.4bn of excess profits – it’s not money you’d go and find in the [energy] companies accounts, it was a very hypothetical view of the Competition and Markets Authority on how the companies should run themselves and how efficient they could be.”

The plan to cap energy charges was revived last week by Mrs May.

However, Ofgem said on Wednesday that it would have to wait for legislation to be in force before it could take action on standard variable tariffs.

The draft legislation will be scrutinised by a committee of MPs intended to build cross-party consensus on how the price cap will work.