They were released because their sentences have expired and the High Court ruled that the government can't detain people indefinitely once their sentence has expired. The danger represented by these people is roughly the same as that represented by Australian criminals released when their sentence expires, as is the usual process.