A federal judge in Pennsylvania has said that President Donald Trump validly invoked the Alien Enemies Act in March as part of an effort to deport Venezuelan gang members.