DEPUTY first minister John Swinney has told how he feared the botched Edinburgh Tram project would become as out of control as the disastrous construction of the Scottish parliament building at Holyrood.

He said the fledgling 2007 SNP government feared the Edinburgh Tram project would spiral into another Holyrood, costing 10 times original estimates, and that it could also cost them their first administration, an investigation into the scandal heard.

The then finance secretary said the decision was made for Transport Scotland to “scale back” its involvement as uncertainty grew around the Edinburgh City Council tram project and when asked he said he would do the same again.

READ MORE: Full Transport Police merger in Scotland 'on the skids' as force seeks new option

He told the Edinburgh Tram Inquiry, which is being held before retired judge Lord Hardie, that he didn’t want the SNP government to be “curtailed” having already lost its vote against the trams just six weeks into office.

Mr Swinney said he wouldn’t do anything differently given a second chance on the trams project, and the primary responsibility was still with the promoter - the council - and not the funder, which was the Scottish Government, with a 91 per cent share in the bill.

He said “there might have been minor transactional points that I might have done differently”, such as setting tighter deadlines.

He added he was "satisfied” overall with his decisions.

During questioning by Jonathan Lake QC, inquiry senior counsel, Mr Swinney agreed one factor for stepping back was so the government “wouldn’t get sucked into demands for more money" beyond the £500m earmarked at that stage.

"Another was the lessons I had deduced from observing other capital projects was that where there was uncertainty as to where leadership and operational delivery responsibility lay there was the opportunity for projects to get into difficulty responsibility," Mr Swinney said.

The inquiry is examining how the tram project eventually cost £776m and was three years late.

READ MORE: Full Transport Police merger in Scotland 'on the skids' as force seeks new option

Holyrood, scheduled to open in 2001, was also three years late but the £414m cost of the parliament building was many times the earlier estimate of £40m.

He said that having to accept an earlier Parliament vote on trams going ahead was “frustrating”.

However, he said: "The decision to proceed that was accepted by the parliament was a political decision by us at that time because we had been six weeks in office and we felt that it was clear we weren’t going to change parliament’s mind on this issue.

"And we were concerned that had we not proceeded with the will of parliament there may have been some possibility that the administration would come under some challenge to its continuation in office and we obviously wanted to avoid that - the first SNP government in 70 years to be curtailed on the basis of the trams project."

The inquiry also heard how ministers announced in 2011 the remaining £72m grant would be withheld, after the local authority warned the route's length could be shortened to Haymarket.

READ MORE: Full Transport Police merger in Scotland 'on the skids' as force seeks new option

Any future payments would have to involve Transport Scotland taking a "greater role in management of the project", which Mr Lake described as a "180 degree".

However, Mr Swinney said it would be "practical assistance" and denied the body should have remained involved from the start, saying that was "speculation" about the effect it would have had on leadership roles.