A federal judge in Los Angeles ordered the Department of Homeland Security on Sunday to make arrangements to bring back an Iranian national who had arrived on a valid visa but was deported under President Donald Trump’s executive order banning travelers from Muslim-majority countries.

Through the American Civil Liberties Union of Southern California and a private attorney, the man, Ali Khoshbakhti Vayeghan, had asked the courts Saturday to step in and prevent his detention and removal from the country.

But before a judge could rule on his request, he was put on a plane back to Dubai, en route to his native Iran.

U.S. District Judge Dolly Gee said in an order Sunday that there is a high likelihood that immigration authorities violated Vayeghan’s constitutional rights and current immigration law with their actions, and directed DHS to fly him back to the U.S. under the terms of his original visa.

“The Court must consider the public interest in upholding constitutional rights,” she wrote in a four-page ruling, which noted Vayeghan stood to “suffer irreparable harm” if she didn’t intervene.

The judge directed the government to not interfere with Vayeghan’s return under his original visa, and to communicate to authorities in Dubai the terms of her order.

Peter Bibring, one of Vayeghan’s attorneys at the ACLU of Southern California, said that his client had arrived in the country to reunite with his wife, who had immigrated from Iran four months earlier. The couple had applied and was approved for legal permanent residency through their son, a U.S. citizen who is in medical school in Indiana.

“This is the cost of the president’s executive orders ― that by treating a huge section of the world with a broad brush, he’s torn apart families, including the families of U.S. citizens like this man’s son,” Bibring told The Huffington Post.

The judge set a hearing in the case for Feb. 10 to determine whether to extend her ruling.

The ruling is yet another legal setback for the Trump administration as it scrambles to explain itself and implement its hastily put-together restrictions. The executive order wrought chaos and confusion for travelers over the weekend, sparking protests and lawsuits that are sure to leave the White House answering for its actions in the courts for years to come.

To make up for the dearth of clarity, DHS Secretary John Kelly said Sunday that the travel ban should not affect green card holders, whose entry he deemed “in the national interest.”

But a separate DHS statement posted Sunday noted that officials would be going above and beyond to make sure that individuals otherwise covered by the ban do not even board planes at their places of origin.

“We are also working closely with airline partners to prevent travelers who would not be granted entry under the executive orders from boarding international flights to the U.S.,” the statement read. “Therefore, we do not anticipate that further individuals traveling by air to the United States will be affected.”