New Zealand authorities imprisoned a man inspired by the Islamic State group for three years after catching him with a hunting knife and extremist videos — but at a certain point, despite grave fears he would attack others, they say they could do nothing more to keep him behind bars.