The judge ruled shortly after a group of refugees filed a similar but broader lawsuit in federal court in Massachusetts seeking to challenge the policy's enforcement nationwide.