Four train companies have started legal action the government after it scrapped the bidding competition to run the Great Western rail franchise and then refused to pay compensation.

In January, UK Transport Secretary Patrick McLoughlin announced the decision to ditch the bidding, saying he still wanted to re-evaluate the franchise following the collapse of the West Coast mainline a few months before.

Now FirstGroup Stagecoach, Arriva and National Express have begun legal proceedings in an attempt to get their money back. If they are successful, the government could be forced to pay out as much as £40m.

At the time, McLoughlin said he did not believe it would be appropriate for the government to reimburse the companies for their bidding cost. He said: "In keeping with the relevant invitations to tender, which made clear that bidders are responsible for their own costs, the Secretary of State does not believe it would be appropriate to reimburse bidders.

"I will also be instructing Directly Operated Railways, a government owned company, to undertake the minimum preparatory measures necessary to operate train services in circumstances where I am unable to agree the terms of an interim agreement with the existing train operator."

The Great Western franchise runs between south Wales and London.

The government will compensate bidders who lost out in the West Coast mainline bid. Nigel Harris, the editor of Rail Magazine, told the BBC the government now needs to be consistent in their handling of this affair.

He said: "A refusal to refund may conform to the letter of the contract rules but utterly fails the 'right thing' test."

"It makes no sense to penalise innocent bidders - especially when you want and need them to re-bid."