More than 40,000 customers of LoveHolidays are to receive long-awaited refunds totalling more than £18 million for trips cancelled due to the pandemic following an investigation by the competition watchdog.

The Competition and Markets Authority (CMA) said LoveHolidays has agreed to give out-of-pocket customers their money back in full by next March at the latest.

The CMA was forced to intervene after receiving hundreds of complaints from LoveHolidays customers who were left waiting for their money back.

When customers contacted LoveHolidays to request a refund for a cancelled holiday, they were told they would only get their money back for their flights once the firm had received refunds from airlines, according to the CMA.

LoveHolidays was reportedly locked in a dispute with Ryanair over who is responsible for refund delays, with the firm last month insisting the airline was dragging its heels.

But online travel agents are legally bound to refund customers for package holidays cancelled due to coronavirus, regardless of whether or not the agent has received money back from suppliers, such as airlines.

LoveHolidays has now signed formal commitments which will ensure that 44,000 affected customers receive full refunds, with £7 million so far refunded to 20,000 customers.

Under the agreement, refunds will be made in two tranches for flights, and hotel accommodation and transfers, with the ultimate cut-off being March 31.

The CMA said it can take LoveHolidays to court if it fails to repay by the agreed dates.

Chief executive Andrea Coscelli said: “Travel agents have a legal responsibility to make prompt refunds to customers whose holidays have been cancelled due to coronavirus.

“Our action today means that LoveHolidays customers now have certainty over when they will receive their money back and they will receive this without undue delay.”

LoveHolidays said it has made the equivalent of 10 years’ worth of refunds in eight months, but admitted it still has “more to do”.

It said pressure on package holiday firms had been “exacerbated by certain airlines refusing to meet their legal obligations with regards to refunds” and insisted money paid for flights was transferred straight to carriers on booking.

A spokesman for LoveHolidays said: “We sincerely thank our customers for their continued patience, and apologise that it has taken much longer than normal to process their refunds.

“Whilst we’ve made significant progress, there is clearly more to do, especially on airline refunds, and we urge all parts of the tourism sector to work together to ensure that customers are refunded as quickly as possible.”

But consumer group Which? slammed LoveHolidays as being “one of the worst culprits” for failing to refund customers.

Rory Boland, editor of Which? Travel, said: “While it’s right that the regulator has stepped in, customers – who are legally due a refund within 14 days – will be angry that, having already waited months, the CMA is allowing the online travel agent to delay these refunds for several more months.

“LoveHolidays is one of countless holiday operators that have let customers down on refunds this year, highlighting the need for widespread reforms across the travel industry.”

It marks the latest action taken by the CMA against holiday firms over failed refunds for trips cancelled due to the coronavirus crisis.

The CMA has already secured refund commitments from Lastminute.com, Virgin Holidays, Tui’s UK business, Sykes Cottages and Vacation Rentals.

It has also written to more than 100 package holiday firms to remind them of the consumer protection laws.