BT-owned mobile operator EE has been whacked with a £2.7 million fine from Ofcom, after it overcharged nearly 40,000 customers.

On two separate occasions, the company was found to have "broke a fundamental billing rule," the UK's communications watchdog said. EE subscribers who called the carrier's "150" number while roaming within the EU were wrongly slapped with charges based on making phonecalls from the US. It meant customers were overcharged £1.20 per minute. They should have been charged 19p per minute.

Ofcom said that 32,145 EE customers were collectively overcharged to the tune of £245,700.

The blunder intensified when EE refused, until Ofcom intervened, to reimburse its out-of-pocket subscribers—a careless and negligent move, according to the regulator. "EE wrongly decided it couldn’t identify the people it overcharged and was proposing to give their money to charity," Ofcom said. It explained what caused the billing boo-boo:

On 16 September 2015, Ofcom received notification from Tüv Süv BABT, the company that approves EE’s metering and billing system, of an "Extraordinary Performance Failure" in relation to that system. This was caused by EE in 2008 instructing its third-party data clearing house to remove the 44 UK international dialling code from the records of customer calls made to certain short code numbers, including EE’s customer service number "150." This meant that, between 1 July 2014 and 20 July 2015, EE’s billing system interpreted the leading "1" digit as the international dialling code for the United States.

EE screwed up, among other things, by failing to check that it implemented accurate instructions to the third party supplier, and didn't subsequently test the tariff charges that led to the overbilling, Ofcom said.

Separately, EE continued charging 7,674 customers who used its "150" number, even after the operator made a free to call or text service in mid-November 2015. Subscribers continued to be charged until January 11, Ofcom said, overcharging them by £2,203.33 in total. On that occasion, EE took "prompt action" to issue full refunds.

"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," said Ofcom's consumer director Lindsey Fussell.

The multi-million pound fine dished out by Ofcom was reduced by 10 percent after EE agreed to a formal settlement, the watchdog said. EE has 20 working to pay the £2.7 million penalty, which will be passed to the treasury in Whitehall.

EE 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.

More than 6,900 subscribers affected by EE's billing gaffes couldn't be identified. This isn't the first time that EE has been fined by Ofcom.

In July 2015, it was hit with a £1 million fine for misleading customers about their rights when making a complaint about the mobile network.

Late last year, EE—alongside parent company BT and sister telco Plusnet—topped the list of Ofcom's most whinged about fixed broadband services.