Thomson and First Choice owner TUI has said the terrorist massacre in Tunisia will have an impact on earnings of up to £32 million.

The attack in June claimed the lives of 38 holidaymakers including 30 UK nationals, who were TUI customers. Two other tourists with the company from Germany and one from Belgium also died. Most of those injured were also its customers.

Tourists were flown home from the North African country and the travel operator has cancelled holidays there, with the UK Foreign Office and other governments still advising against visits.

The cost of the flights home was €10 (£7m) while the impact of empty hotels in a region that normally accounts for just under half a million TUI visitors a year is expected at €25m to €30m.

Together with other costs, the total impact is seen at €35m to €45m, a spokeswoman for the company said.

Tunisia has in the past represented three per cent of the company's annual tour operator programmes. TUI set out details of the impact in a trading update for the third quarter to the end of June.

Joint chief executives Friedrich Joussen and Peter Long said: "This quarter was marked by the tragic events in Tunisia at the end of June.

"Supporting our customers, their families and our colleagues through this sad time remains our highest priority.

"We are very proud of the commitment and dedication our colleagues have shown throughout this unprecedented situation."

Mr Long described the attack as a "human tragedy that completely overshadowed our quarter". He said it was "the most horrific event I and my company have ever had to deal with".

TUI also said that bookings to Greece in late June and the first half of July were hit by economic uncertainty in the region.

But Mr Long said that overall there had been no impact as after a slowdown in bookings there had been a recovery.

The figures come after rival Thomas Cook revealed a £25m hit to earnings from events in Tunisia and Greece.

Mr Long said that after the Tunisia attack, 18 additional flights were laid on to bring holidaymakers home, including 13 from the UK, four from Belgium and one from the Netherlands.

Most of those with trips booked to Tunisia were re-booked on 26 extra flights to 13 destinations including the Balearic Islands, mainland Spain and Cyprus.

Mr Long said: "Our priority has been to support our customers, their families and colleagues impacted by this horrendous event.

"Both I and all my colleagues still remain in deep shock as a result of the tragic loss of life and injuries to our customers."

Despite the tragedy, TUI delivered an 18 per cent rise in underlying earnings for the quarter to €194m (£138m).

Mr Long said summer trading remained "robust" while bookings for the winter were in line with expectations and there had been a good start for the summer 2016 period.