Mobile phone firm EE has been fined £2.7 million by Ofcom for overcharging tens of thousands of customers.

The communications regulator found that the company broke a 'fundamental billing rule' on two separate occasions, resulting in nearly 40,000 customers being overcharged around £250,000.

An investigation by Ofcom accused EE of 'carelessness or negligence', adding that while it did not set out to make money from its billing mistake, the company had decided not to reimburse the majority of affected customers until Ofcom intervened.

Lindsey Fussell, Ofcom's consumer group director, said: "EE didn't take enough care to ensure that its customers were billed accurately. This ended up costing customers thousands of pounds, which is completely unacceptable.

"We monitor how phone companies bill their customers, and will not tolerate careless mistakes. Any company that breaks Ofcom's rules should expect similar consequences."

EE is owned by telecoms giant BT, which acquired the mobile operator last year in a £12.5 billion deal.

EE customers who called the company's 150 customer services number while roaming within the EU were incorrectly charged as if they had called the United States.

Ofcom said the mistake saw customers charged £1.20 per minute, instead of 19p per minute. As a result, at least 32,145 customers were overcharged around £245,700 in total.

It added that EE wrongly decided it could not identify the people it overcharged and was proposing to give their money to charity, which would have left them out of pocket.

In another breach, despite making it free to call or text the 150 number from within the EU from November 18 2015, EE continued to bill 7,674 customers up until January 11 2016.

In total, these customers were overcharged £2,203.33, although in this instance EE issued full refunds to those affected.

Proceeds of the fine will be passed on to the Treasury.

Ofcom said the penalty reflects a 10 per cent reduction in light of EE's agreement to enter into a formal settlement and its admission of full responsibility for the breaches.

While the majority of customers have now been refunded, EE was unable to identify at least 6,905 customers, who have been left around £60,000 out of pocket.

The company has made a donation of just under £62,000 to charity in lieu of the payments owed to these customers.

However, Ofcom is requiring EE to make further attempts to trace and refund every customer who was overcharged.

An EE spokesman said: "We accept these findings and apologise unreservedly to those customers affected by these technical billing issues between 2014 and 2015.

"We have put measures in place to prevent this from happening again, and have contacted the majority of customers to apologise and provide a full refund.

"For those customers that we could not identify, we donated the remaining excess fees to charitable causes in line with Ofcom's guidelines.

"Following Ofcom's findings, we have made a number of additional improvements to our systems and policies to allow us to better support our customers in the rare occasion that billing issues do occur."