Detention, Challenging the Legality of Detention