The Oamaru Courthouse is to be re-opened and restored after an agreement between the Justice Minister and Waitaki District Council.
The building was closed in December 2011 after failing to meet minimum earthquake standards.
Ownership of the court will be transferred from the Ministry of Justice to the District Council, which will strengthen the building and lease it back to the ministry.
Justice Minister Amy Adams said the council would be able to use the building outside court sitting hours for council-related activities.
She said the court will be ready for use by the end of the year.