It was hunted to near extinction by introduced predators and considered extinct for several decades until a handful of survivors were located in some very remote areas.
When the survivors were found, the department of conservation moved them into a breeding program on some offshore islands where they would be free from predators. Since then the population has slowly grown and predator eradication programs on the mainland have had enough success that we're now taking a calculated risk on moving some of them back to their original habitat.
So we were aware they weren't completely extinct since we were keeping a few around? The title makes it seem like it just popped up and was a complete surprise.
This happens more often than you would expect. Many animals have been declared extinct for a long time only to return. It happened with ivory billed woodpeckers in the US