A takeover deal to secure the future of Cardiff City FC has been signed just minutes before the deadline.
The takeover deal was vital to funding the 30,000 stadium project
There were fears that the club could have been put into administration if a deal was not done by noon on Friday.
But director Steve Borley confirmed the agreement was struck at 1145 GMT on Friday to sell former chairman Sam Hammam's controlling stake.
It is crucial to a new ground and manager Dave Jones had warned he could have walked away without the deal.
The £27m buyout of Hammam's majority shareholding is set to clear the Bluebirds' debts and leave Jones with a budget to strengthen the team, which has undergone a slump in form after weeks at the top of the Championship.
Former Leeds chairman Peter Ridsdale was brought in by Hammam to find a way of stemming the club's losses.
He found new investors in the club for the takeover deal - needed to build the planned 30,000-seater new stadium as part of a 60-acre retail development - but the people with the new money wanted Hammam to cut his ties with the club.
Ridsdale, who is determined to restore his football reputation following his departure from Leeds United, is likely to be credited as the man who finally delivered the stadium.
Manager Dave Jones was worried by the delay in the takeover deal
In a statement, Ridsdale apologised to fans for the "uncertainty that has surrounded the future of the club and its stadium project".
He added: "[The deal] has allowed the council to today sign off the planning consents for the new stadium project and to enter into the 90-day judicial review period, at the end of which building can start.
"Following the EGM [on 12 January] the club will have the money to support it financially and to build the new stadium."
Cardiff Council had been reluctant to give its go-ahead to the retail scheme until it received assurances over the viability of the plans.
Failing to sign the takeover deal by noon on Friday would have put the skids under the takeover and, consequently, the stadium bid.
Borley told BBC Radio Wales: "A deal has been done - we got everybody to see sense and we got an agreement right at the 11th hour and it's sorted and can go forward.
"The uncertainty surrounding the club has disappeared and the manager can get on with his job and the players can not worry about whether they're going to get paid at the end of the month."
Work on the £38m stadium in Leckwith, near the club's current Ninian Park ground, is due to begin in March next year.