The ruling underscores national border security concerns after the judge heard harrowing victim statements.