Yes, solders are trained to obey legal orders, in every war there are cases of individuals or groups who loose control and break discipline
In thinking about legal orders I'm reminded of the P-47 pilot who wrote post D-Day they were ordered to strafe the civilians clogging the roads, in order to hamper German military movement. The order stuck in his craw. Legal Order?