If the detention is imposed as a collective punishment, it violates laws against detention without a fair trial. However, it may well be an administrative decision made for the protection of both locals and those on detachment.
Have fun trying to prove that it was one or the other.