But the migrants who the Trump administration claims are gang members must be given "reasonable time" to seek a legal review before they are deported, the Supreme Court rules.
The court, which has a conservative majority, also announces that the reviews must take place in Texas instead of in a courtroom in Washington.
The court was bitterly divided in its decision and voted it through with 5–4. Among others, the three judges who are usually described as liberal voted no to the proposal.
In the decision, the three judges write that the Trump administration has previously tried to avoid judicial review in the case, and that the Supreme Court is now "rewarding the government for its behavior". A fourth judge joined parts of the views.
Trump: A big day
Donald Trump praises the decision on social media.
"The Supreme Court has upheld the rule of law in our nation by allowing a president, whoever it is, to secure our borders and protect our families and our country itself. A big day for justice in America!", he writes on Truth social.
A lawyer at the ACLU organization, which has sued the state regarding the deportations, says that the important thing in the Supreme Court's decision is that people must be given a court process before they are deported.
It's an important victory, says Lee Gelernt.
Many twists
The twists in the issue have been many. In March, Trump invoked the law to deport over 200 alleged Venezuelan gang members to El Salvador. A federal judge stopped the deportations – which were still carried out.
The whole thing then took another turn when the president demanded that the judge in question, James E Boasberg, be impeached – something the Supreme Court's chief judge John Roberts in a rare statement rejected.
Last week, Boasberg held a hearing on whether the government defied his court order when they carried out the deportations anyway. But the government refused to provide more information about the matter, and instead invoked a "state secrets privilege".