When the phone rang, Sir Richard Branson was looking out across the Hudson
river from in his room on the 17th floor of New York's Standard hotel.

The Virgin founder had been put on alert, four hours earlier, to expect a call at 11.30pm London time. It would be from Patrick McLoughlin, Britain's new Transport Secretary – and the man with whom he was embroiled in a legal fight over the West Coast rail bid.

Branson had been racking his brains over what to expect. But even he did not foresee the bombshell that McLoughlin was about to drop. Or the chaotic events that would now be unleashed, throwing the entire rail industry into limbo. And all thanks to the blinding incompetence of a government department.

"He basically said that the Department for Transport was 100pc guilty and he was very apologetic," said Branson on Wednesday. "And that he was cancelling the competition because of significant flaws in the way they had handled the process – errors on passenger numbers, inflation, growth forecasts."

Losing bid battles is part of the commercial cut and thrust of operating on the railways. But the harder Virgin and Stagecoach's top duo – chief executive Sir Brian Souter and finance director Martin Griffiths – looked at the winning bid, the less they understood it.

As Branson put it: "As a dyslexic businessman I do everything on the back of an envelope. But I couldn't make FirstGroup's bid work on my envelope. The numbers just didn't add up."

Even before the winning bidder was announced on August 15, Branson had written to the then Transport Secretary Justine Greening, complaining that FirstGroup's bid was "unrealistically high" – just as GNER's and National Express's had been on the East Coast. His feelings hardened when he saw what FirstGroup had actually bid.

Virgin Rail was convinced that the DfT had made at least two major errors. First, over how it had "risk adjusted" the rival bids. And, second, over the amount of money it had asked FirstGroup to put at risk to protect the taxpayer if it failed to deliver on its promises. Having been repeatedly brushed off by the DfT when it requested an explanation, Virgin Rail launched a legal challenge.

The company undertook to pay back £13.3bn cash by the end of 2028. That was based on 10.4pc a year annual revenue growth, all off the back of a double-dip recession. But crucially the cash returns were so loaded to the end of the contract that the taxpayer was largely better off with Virgin until 2021.

Branson, who dubbed the whole process "insane", last month told MPs on the Transport Committee that O'Toole had "bid a small amount of money in the first few years" to get a boost to cash-flow, and then when the big repayments kicked in, planned to "hand back the keys". O'Toole, who yesterday saw FirstGroup's shares dive more than 20pc on fears over its balance sheet and dividend, shot back: "I don't see any chance of handing them back."

For perspective, though, in the last year of the contract O'Toole planned to repay more than £1.5bn, dwarfing FirstGroup's current £930m market value. Passenger revenues on the service only reached £824m last year, when Virgin Rail repaid £160m. True, Virgin has achieved 10.2pc revenue growth over the past 10 years but that's after a £9bn upgrade and new Pendolino trains.

By contrast, Virgin Rail offered a still chunky £11bn based on annual revenue growth of 8.5pc. But as one insider explains: "What the DfT is supposed to do is risk adjust all those figures. It looks at bidders' plans to grow revenues, such as ticketing initiatives, GDP forecasts, margin and cost assumptions. All that goes into the DfT's model, which then produces a figure for the risk premium. It's clear they just didn't do it properly."

That figure is supposed to determine the size of the subordinated loan facility – the amount the winning bidder risks forfeiting if it fails to fulfil the contract. FirstGroup was asked to put up £190m versus Virgin's £40m. But, as Griffiths told MPs on the Transport Committee, when Virgin Rail ran FirstGroup's numbers it reckoned the DfT should have asked for nearer £600m. That is a vast difference. As one rail figure puts it: "Imagine if the DfT had rung up O'Toole and said 'you've won, now we want £600m'. No way would his shareholders have allowed him to put that at risk."

McLoughlin admitted as much in the early hours of yesterday morning, saying the DfT "cannot be confident that these flaws would not have changed the outcome of the competition". The errors emerged as the department was about to send its case to court for rejecting Virgin's application for a judicial review. As one insider said: "McLoughlin knew he was about to get annihilated."

The upshot is total chaos, even by the standards of a department Souter once branded "dysfunctional" – a phrase McLoughlin amusingly repeated back to him when he phoned him after Branson. Not only has the West Coast bid been shunted into the sidings, pending two reviews by senior businessmen, but so too have the Great Western, Essex Thameside and Thameslink franchises. Around £50m of bid costs are being returned. And Labour, responsible for its fair share of transport cock-ups, is using its conference to make political hay.

Meanwhile, three officials have been suspended. The DfT won't say who, but there is industry gossip the trio include John Gilbert and Kate Mingay – both responsible for procurement. Suspensions are not thought to include Peter Strachan, major projects director.

Industry sources reckon they are carrying the can for Greening, who is accused of acting "unlawfully" and "irrationally" in Virgin Rail's legal claim. She was moved in the reshuffle to International Development, and Theresa Villiers, the former rail minister promoted to Northern Ireland Secretary. The pair have embarrassed McLoughlin, not least since he told the Transport Committee only on September 12 that the bid was "judged fairly".

Permanent Secretary Philip Rutman looks equally humiliated, having told the same MPs how the DfT's "exhaustive" due diligence included a "more sophisticated and evidence-based approach to risk".

Senior industry figures now want the DfT out of the way on rail bids. One said: "I'd like to see the return of Opraf [the former Office of Passenger Rail Franchising], where decisions get taken by experienced commercial people who can take the politics out."

What too of FirstGroup? O'Toole is now under pressure to replace £40m cash flow this year and around £50m of operating profits next. "I don't think the dividend looks sustainable," said Gert Zonneveld, a Panmure Gordon analyst.

Branson, who is now offering to run the West Coast on a management contract until the Government sorts out the mess, was magnanimous, saying of McLoughlin: "We respect this minister for taking it on the chin in taking 100pc responsibility." Maybe that's because he had him 100pc bang to rights.