THE deal to deliver new powers for Holyrood almost fell apart at the last moment after George Osborne refused to sign it off, the Sunday Herald can reveal.

After months of negotiations and an apparent agreement between Edinburgh and London, the Chancellor blocked the Scotland Bill last week, jeopardising a critical Holyrood vote on it.

His refusal to sign off on a technicality caused consternation in Whitehall, and led to a cross-border stand-off between the Conservative and SNP administrations.

Nicola Sturgeon held a series of urgent phone calls with John Swinney before rejecting a Treasury demand for a change that could have cost Scotland up to £200m a year.

Her decision meant the final, high-profile vote on the Bill by MSPs was almost cancelled.

After 26 hours of wrangling, Osborne finally blinked and backed down and the Bill was passed by MSPs on Wednesday, allowing it to continue its passage through Westminster to become law.

However insiders say that, behind the scenes, the Chancellor came perilously close to sinking the Bill - a blunder that would have handed the SNP a propaganda coup for the election.

It is understood the Scottish Office and Cabinet Office put pressure on the Treasury in order to avert a political disaster.

“I think the Treasury did it to test our resolve,” said one Scottish Government source. “They thought that, even if they made a late change that cost us money, we wouldn’t have the balls to say no to more powers, but we did. They got the fright of their bloody lives.”

Designed to deliver pre-referendum promises of greater devolution - the so-called 'Vow' - the Scotland Bill will transfer major tax and welfare powers to Holyrood.

For months, the UK and Scottish governments tried to agree a set of rules, or “fiscal framework”, to make the powers work in practice.

The Treasury’s preferred method could have cost Scotland £7bn over a decade, so the Finance Secretary and the First Minister rejected it.

However on February 23, with time running out for Holyrood to scrutinise a framework, David Cameron finally announced a deal had been agreed, largely on the SNP’s terms.

Although some of the fine print still had to be thrashed out in a technical annex, Scottish and UK officials thought they had settled everything by early March.

Then last weekend, when the SNP was having its conference, the Treasury began objecting to the agreed method for reconciling shortfalls in cash due to Scotland.

This had started as an annual process, meaning Scotland would not go out of pocket for long, but the Treasury suggested a new system which would have introduced a two-year lag. In the worst case scenario, Scotland would have been £200m short in one year.

After the SNP government refused to accept the plan, the Treasury seemed to back down. However just after 2pm on Monday, officials in Edinburgh were told Osborne had refused to sign off the technical annex, meaning the fiscal framework was up in the air again.

“At this point, it seems the Scotland Office and Cabinet Office started running round as if their hair was on fire,” said an SNP insider. “They really didn’t want the process to fail.”

The timing was critical: SNP ministers were due to lodge a motion at Holyrood by 4.30pm on Monday in order to tee up Wednesday’s vote.

In a series of calls, Sturgeon, in Glasgow, and Swinney, in Edinburgh, discussed what to do. Holyrood’s Presiding Officer Tricia Marwick was alerted to the unfolding crisis.

Sticking to her promise not to accept any deal that caused a “detriment” to Scotland’s finances, Sturgeon rejected the Treasury’s demand and refused to lodge the motion.

Early on Tuesday morning, SNP business manager Joe Fitzpatrick told the opposition party whips the motion had been held up until later in the day, but did not explain why.

The time pressure was now intense: unless the motion was lodged by 4.30pm on Tuesday, the vote to pass the Bill on Wednesday would be cancelled and the behind-the-scenes problems would spill into the open and an almighty row would erupt, risking more delays.

The Holyrood vote was also needed to allow the House of Lords to proceed with their side of the Bill the following week - and if that was knocked off course, it could mean the Bill being timed out at Holyrood, as the parliamentary terms ends on March 23 for the election.

The result of all the dominoes falling would have been the Scotland Bill collapsing, the 'Vow' being broken, and the SNP gifted a propaganda tool to bash unionist rivals in May.

However shortly before 4pm on Tuesday, after a series of face-saving tweaks agreed to by the SNP government, the Treasury said Osborne had finally signed off and the deal was secure. The parliamentary motion was lodged at 4.12pm, just 18 minutes before deadline.

“It was 26 hours of ridiculous nonsense,” said one exasperated source close to the events.

A UK Government spokeswoman said: “The UK and Scottish governments agreed the fiscal framework on 23 February and officials have now finalised the technical details. The deal is fair to Scotland and the rest of UK and brings greater accountability to the Scottish Parliament. With only a few days before the Scottish Parliament dissolves for the election, the people of Scotland are looking forward to the debate about how the new powers are used.”