Drug firms Pfizer and Flynn Pharma have been fined nearly £90 million for "excessive and unfair" pricing to the NHS after hiking the cost of an anti-epilepsy drug by up to 2,600% overnight.

The Competition and Markets Authority (CMA) said drug maker Pfizer and distributor Flynn Pharma broke competition law when they increased the cost of a medicine used by around 48,000 patients in the UK.

The watchdog said their moves saw the cost to the NHS of phenytoin sodium capsules rocket from around £2 million a year in 2012 to about £50 million in 2013 - far more than Pfizer was charging in any other European country.

Pfizer was handed a record £84.2 million fine, while Flynn Pharma was fined £5.2 million.

The CMA has also ordered both firms to reduce their prices for the anti-epilepsy drug.

The CMA said that before September 2012, Pfizer made and sold phenytoin sodium capsules to UK wholesalers and pharmacies under the brand name Epanutin and the prices of the drug were regulated.

But Pfizer sold the UK distribution rights for Epanutin to Flynn Pharma in September 2012, which then saw the drug de-branded - or made generic - meaning that it was no longer subject to price regulation.

Both firms then each ramped up the price of the drug, meaning that overnight the NHS saw the cost surge by between 2,300% and 2,600%, according to the CMA.

It said the NHS at one stage saw the price of 100mg packs of the drug jump from £2.83 to £67.50.

The NHS had no alternative but to pay, as epilepsy patients who are already taking phenytoin sodium capsules should not usually be switched to other products due to the risk of loss of seizure control.

Philip Marsden, chairman of the case decision group for the CMA's investigation, said: "The companies deliberately exploited the opportunity offered by de-branding to hike up the price for a drug which is relied upon by many thousands of patients.

"These extraordinary price rises have cost the NHS and the taxpayer tens of millions of pounds."

He added: "This is the highest fine the CMA has imposed and it sends out a clear message to the sector that we are determined to crack down on such behaviour and to protect customers, including the NHS, and taxpayers from being exploited."

The CMA said Pfizer and Flynn Pharma abused their dominant positions in the market by over-charging for the drug.

Pfizer claimed the anti-epilepsy drug Epanutin was loss-making before it was de-branded, but the CMA found that any losses would have been recouped within two months of the price rises.

Both firms have now been given up to four months to reduce their prices, to ensure there is no risk to the supply of the drug to patients who rely on it.

The CMA said the firms could charge prices which are profitable, but they must not be excessive and unfair.

The fine comes after GlaxoSmithKline and a number of generic pharmaceuticals were hit with a £45 million penalty in February after a "pay-to-delay" scandal surrounding blockbuster anti-depressant drug Seroxat.

Glaxo was found to have made more than £50 million of payments to companies making cheaper generic versions of Seroxat to delay them coming to market.

Pfizer rejected the findings and plans to appeal against the decision.

It said its distribution rights deal with Flynn Pharma in September 2012 "represented an opportunity to secure ongoing supply of an important medicine for patients with epilepsy".

"In this transaction, and in all of our business operations, we approached this divestment with integrity, and believe it fully complies with established competition law," it said.

The group added the increased price of the drug was still 25% to 40% lower than the cost of an equivalent medicine by another supplier to the NHS.

Flynn Pharma said it will also appeal against the decision.

David Fakes, chief executive of Flynn Pharma, said: "We believe that left unchallenged, the CMA's decision today would stunt investment in generics, eventually leading to a reduction in supply and less choice for doctors and patients.

"It is a matter of common interest for us to appeal and see this decision overturned."