Oamaru's council is to spend $900,000 doing up the town's historic courthouse so it can be leased back to the government.
The Waitaki District Council has spent five years working on the deal since the Ministry of Justice closed the 130-year-old building because of earthquake risk and set up a portable court in a carpark.
The council today approved the deal to quake-strengthen and refurbish the building.
District mayor Gary Kircher said it was a significant moment because the town wanted to keep court hearings in Oamaru, restore the courthouse building and do it at no cost to ratepayers - and they have achieved all of that.
Mr Kircher said he hoped the courthouse could be re-opened by the start of next year.