BOSTON (AP) — An Iranian student attending college in Boston was denied entry to the U.S. and ordered to immediately fly back to his native country, despite a court order temporarily staying his removal, immigration lawyers and civil rights groups said Tuesday.

Shahab Dehghani, a 24-year-old economics student at Northeastern University, arrived in Boston with a valid student visa but was detained by U.S. Customs and Border Patrol at Logan International Airport, according to his lawyer Kerry Doyle.

Customs officials ordered Dehghani, whose full name is listed as Mohammad Shahab Dehghani Hossein Abadi on federal court filings, to leave on the next available flight because they determined he was intending to reside in the U.S. longer than his temporary student visa allowed, Doyle said.

Dehghani's lawyers reject that claim. They say he had attended the University of Massachusetts Boston before transferring to Northeastern, had undergone a nearly one-year visa review and planned to return to Iran when he completed his studies.

“He’s understandably upset,” said Heather Yountz, a lawyer also involved in Dehghani's case. “He’s been a student here in Massachusetts for two years. His life has now been turned around.”

Customs and Border Patrol declined to comment on specifics but said each person seeking entry to the country has the burden to prove they can overcome “all grounds of inadmissibility,” including "health-related grounds, criminality, security reasons, public charge, labor certification, illegal entrants and immigration violations, documentation requirements, and miscellaneous grounds.”

While he was at the airport Monday, Dehghani's attorneys filed an emergency lawsuit seeking to hold off his removal, which a federal judge quickly approved, pending a court hearing Tuesday.

But Judge Richard Stearns on Tuesday said the case was moot and out of his jurisdiction because Dehghani ended up flying out of the U.S. that night.

Doyle confirmed Dehghani took a flight to Paris on Monday but disputed the judge's assertions.

She also challenged federal prosecutors who argued Dehghani was removed from the country before the emergency order was issued. Doyle a rgued he was still at the airport at the time the judge issued the temporary stay , suggesting customs officials violated the order.

She said her client intends to fight the case and will weigh his legal options.

Northeastern University said it has also been in touch with federal officials to try and get Dehghani back to Boston for his classes.

“We still have not received a satisfactory explanation from Customs and Border Protection for this action,” the university said late Tuesday. ”Only in the most extreme instances should students have their academic pursuits interrupted by government intervention.”

Doyle and other immigrant rights activists say Dehghani's case is the latest example of customs officials at Logan Airport ignoring court orders since President Donald Trump issued a ban on travelers from several predominantly Muslim countries in 2017, including Iran.

Since August, at least 10 students have been sent back to Iran upon arrival at U.S. airports. Seven had flown into Logan, according to the American Civil Liberties Union of Massachusetts, which is also assisting Dehghani.

“We feel the Iranian community has been unfortunately targeted," Doyle said. "We’re hearing many reports, especially at the Boston port of entry, of Iranian students and other individuals being subjected to increased and severe interrogation at secondary inspections."

Civil rights groups and lawmakers complained this month to federal officials after Iranian Americans said they had been questioned for hours at the Canadian border in Washington state in the days after U.S. forces killed a top Iranian general and the Trump administration feared retaliation from Iran.

Hamed Yarmand was among more than two dozen people who rallied outside of Boston federal court Tuesday in support of Dehghani.

Yarmand, who is Iranian American, said he was one of Dehghani's professors at UMass Boston and described him as a good student who was involved in school activities.

“It's not fair,” Yarmand said. “President Trump says he supports the Iranian people. But how does that work, with these sanctions and this travel ban? There seems to be a contradiction with what he says and what this administration is doing in practice.”

Associated Press Education Writer Collin Binkley contributed to this report.