Rachel Reeves, who chairs the Business Committee in the Commons, said: "Energy consumers have been overcharged for too long and the government now needs to quickly ensure this legislation is passed in time to protect customers next winter."

The law will limit the cost of firm's standard default tariffs until 2020. Following that, the cap may be extended on an annual basis until 2023.

What is a standard variable tariff?

When customers' fixed-term deals end they usually automatically move to this tariff, which applies to 11 million households. Ofgem says the price difference between the average standard variable tariff default deal and the cheapest rate in the market was £308 at the last count in December.

What does the government want to do?

It is moving to introduce legislation to cap these variable tariffs, overseen by Ofgem. This will not take effect until the law is passed. The government wants it done by the end of the year at least.

What happens in the meantime?

Some suppliers are moving towards abandoning variable tariffs. Ofgem has also changed the rules to allow suppliers to default customers on to another fixed deal. Customers are still likely to be better off by searching and switching themselves.

Prime Minister Theresa May said: "It's often older people or those on low incomes who are stuck on rip-off energy tariffs, so today we are introducing legislation to force energy companies to change their ways."

The move is an admission that encouraging consumers to regularly switch providers to pay less has not been as successful as hoped.

About a third of households are charged a variable price for their energy at a default rate set by their energy company, because they have not chosen to shop around for a cheaper fixed-price deal.

The Department for Business Energy and the Industrial Sector said that the energy market was not working and that domestic customers of the "Big Six" energy companies were paying on average £1.4bn a year more than they would in a truly competitive market.

"We're going to give powers to Ofgem to make this energy market work for everybody by winter 2018, to set a maximum absolute cap [to be] paid by customers on standard variable and default tariffs, the tariffs that the majority of households are on and sometimes don't even know it," the Energy and Clean Growth Minister, Claire Perry, told the BBC's Today programme.

The Business Department says the average annual savings between standard tariffs and fixed rate deals could be up to £300.

The changes are separate from Ofgem's safeguard tariff, which is already helping some five million vulnerable customers pay lower prices.

The key decision over what level the new cap will be set at will be made by Ofgem.

Energy UK, which represents the major suppliers, said it was important that the price cap reflected costs - most of which were outside their control, such as distribution costs and the wholesale cost of energy.

Lawrence Slade, chief executive of the industry body, said energy providers were concerned a cap would damage investment and competition.

"The risk of unintended consequences around caps is serious. What we have to do is, working with Ofgem and the government, is make sure the cap has sufficient headroom to allow competition to continue," he told the BBC.