South Korea’s constitutional court on Thursday narrowly upheld a law banning same-sex relations within the armed forces, citing a possible risk to the military’s combat readiness in a ruling criticised by activists as a setback for gay rights.