Supreme Court rules in favour of military courts