Owners of Denbigh's former North Wales Hospital lost a High Court bid on Thursday to overturn Denbighshire council's compulsory purchase order of the Victorian mental asylum.
It has been involved in a long-running row with the owners over its future.
Councillor David Smith said the authority planned to buy the building and transfer it to a trust to renovate.
The hospital closed in 1996 and the site was later bought by Freemont (Denbigh) Ltd.
Permission for housing was secured but work never began.
In 2011 the council, frustrated at the deterioration of the Grade II-listed building, served an urgent works notice on the company and then carried out repair work by default.
But in August last year, Freemont lost an appeal over the council's attempt to recover Â£900,000 it spent on emergency repairs.
The council has agreed to pass ownership of it to the North Wales Building Preservation Trust, a non-profit organisation, which will receive support from the Princes Regeneration Trust.
The authority added the trust hopes to build housing on the site.
Plans to restore a derelict landmark building in Denbighshire have moved one step closer.