Ofcom has fined Royal Mail a record £50m for breaching competition law.

The fine is for its actions in 2014 when Whistl, which was then known as TNT, was trying to become its first competitor in wholesale mail delivery.

The regulator's investigation, which followed a complaint by Whistl, said Royal Mail had abused its dominant market position and discriminated against the company.

Whistl is seeking damages, but Royal Mail said it will challenge the fine.

Ofcom's investigation found that Royal Mail price rises in 2014 meant any of its wholesale customers such as Whistl that wanted to compete with it would have to pay higher prices in the remaining areas where it used Royal Mail for delivery.

Ofcom's investigation found that Royal Mail's actions amounted to "anti-competitive discrimination against customers, such as Whistl, who sought to deliver bulk mail".

Jonathan Oxley, Ofcom's competition director, said: "Royal Mail broke the law by abusing its dominant position in bulk mail delivery.

"All companies must play by the rules. Royal Mail's behaviour was unacceptable, and it denied postal users the potential benefits that come from effective competition."

Royal Mail said it was "very disappointed" by Ofcom's decision and "strongly refutes any suggestion" that it had breached the Competition Act, adding: "The decision is without merit and fundamentally flawed."

It said the price changes were designed to protect the Universal Service, which, unlike its competitors, it was required to continue providing.

The Universal Service means post is charged at the same rate, regardless of where it is sent to across the UK.

Royal Mail said Ofcom's chief role was to prevent rivals from picking off the profitable, usually urban, deliveries.

A spokesperson for Whistl said: "We have to review the Ofcom findings in detail and establish the level of damages we can seek from Royal Mail.

"Initial advice is that Royal Mail is potentially liable to pay compensation for the significant damage that was caused to Whistl's business, in addition to the fine imposed by Ofcom."

Analysts at Liberum said even if the fine was upheld, it would not damage Royal Mail's profits - but could limit its expansion: "Although the fine itself is not material, and the competitor that brought the complaint has long since withdrawn from the market, we see broader potential implications.

"Importantly, we believe this is a reminder that Royal Mail must act with restraint given its dominant market shares in both letters and parcels, and this limits the group's ability to grow parcels revenue over the long term."

Royal Mail shares rose 1.1% to 467.7p in morning trading in London, valuing the company at £4.6bn.