What is the 1798 law Donald Trump has invoked for deportations?

The Supreme Court has allowed the Trump administration to use a 1798 wartime law, the Alien Enemies Act, to deport Venezuelan migrants it accuses of being gang members, ending the temporary halt on deportations ordered by a federal district judge.
But the court also ruled that the administration must give Venezuelans it claims are gang members the chance to legally fight any deportation orders.