The Scottish Government agreed an indemnity clause while brokering the deal between Tata Steel and Liberty Steel, owned by Sanjeev Gupta, in 2016 for the purchase of the steel slab plant.
The clause means certain liabilities that may fall on previous owners Tata Steel would be covered by the government.
In the sale to Liberty Steel, it is understood the Government received an equivalent indemnity clause, passing on that liability to GFG Alliance.
However, while undertaking contingency planning following the collapse of GFG Alliance’s largest funder Greensill Capital, officials discovered the clause between it and Tata Steel may break state aid rules.
Business minister Ivan McKee said advice around state aid was “different” at the time of the deal, which progressed “at pace”.
Opposition parties said this was further evidence of an incompetent government intervention in the private sector, following on from the controversies around the Lochaber guarantee and BiFab.
It is understood the indemnity would only likely be called upon if GFG Alliance ceased trading and there were no assets to cover the costs of environmental clean-up, should Scotland’s Environmental Protection Agency choose to charge former owners for a share of the clean-up costs if the site later required it.
The indemnity would have seen this cost owed by Tata Steel paid by the Scottish Government, potentially breaching state aid rules.
The Scottish Government has said the clause is “unenforceable” and claimed “no money would be paid out by the Scottish Government”.
However, this could be challenged by Tata Steel, which could open the government up to unknown costs.
No figure for the potential cost to the taxpayer was provided by the minister.
Mr McKee told MSPs the key clause in the contract between Tata Steel and the Scottish Government was “no longer valid”.
He said: "If the wider [Liberty Steel] group fails to exist and the site is going to be repurposed to a different use, then some of those liabilities, for environmental remediation, may then crystallise to the operators of the site currently and to any previous operator of the site.
"Many varying factors would need to happen before such a scenario would come to fruition. It was, however, imperative that having identified this clause was no longer valid, I made the relevant business and the chamber aware of the situation.”
Mr McKee faced criticism from opposition parties around his inability to answer the question of when the government discovered the mistake and the wider impact on the plant, its workers and the taxpayer.
Daniel Johnson, Scottish Labour’s finance spokesperson, said the statement raised questions about the competence of the Government’s involvement in the private sector.
He said: “There remains critical questions to be answered about this in terms of their being a future liability for the Government, but more importantly how and why are the Scottish Government signing off these deals that break competition law and potentially leave us with bills.
"This underlines all the questions that arose from the Lochaber deal and compounds them.”
Scottish Liberal Democrat economy spokesperson Willie Rennie echoed these concerns and called on Mr McKee to “urgently clarify” the impact of his statement.
He said: “After BiFab and Lochaber, this is another industrial intervention balls-up from this Government. It’s amateur hour.
"What does this say to companies who may be interested in doing business with this Government in future? How can they trust the Government to deliver on its agreements?
"I know the minister wishes nothing will go wrong, but he needs to be frank about the potential consequences.”
A spokesperson for Tata Steel UK said: “We consider the 2016 sale agreement, which was negotiated in good faith between the Scottish Government and Tata Steel on commercial terms, to be valid and binding in all aspects.
"We would welcome further dialogue with the Scottish Government on this matter to understand its position in more detail.”