A FEDERAL JUDGE issued a 48 hour stay of the deportation of an Iranian student enrolled at Northeastern University, who arrived back in the US on Sunday night and was detained by immigration officials at Logan Airport.

US District Court Judge Allison Burroughs issued the ruling on Monday night less than two hours after attorneys for Shahab Dehghani filed an emergency petition in the case.

Dehghani, 24, began attending the University of Massachusetts Boston in 2015 before transferring to Northeastern. He had returned to Iran and reapplied for a student visa, which took almost a year to be approved.

When Dehghani’s connecting flight from Paris arrived in Boston on Sunday at about 5 p.m., however, he was made aware that he would not be allowed to remain in the US, despite being cleared to study here.

Mehran Dibaji, a friend of Dehghani’s, said “someone at the airport called his housemate” saying “they’re deporting your friend.” He added that Dehghani, who he described as “very peaceful and very friendly,” had left Northeastern temporarily to visit his family, since the travel bans from 2017 bar most Iranians from staying in the US. Dehghani’s family found out about his detainment through his friends, he said, not from border patrol.

Immigration activists quickly spread word of Dehghani’s potential deportation, and more than 100 demonstrators gathered Monday night at the international terminal at Logan, holding signs protesting his possible removal. According to court records, his visa was revoked during an arrival interview despite it being valid.

Dehghani’s attorney, Susan Church, learned he was being detained Sunday night after he had been held by Customs and Border Patrol for several hours.

Customs and Border Patrol said it cannot comment on an individual’s processing due to the Privacy Act. A spokesman said that applicants must “demonstrate they are admissible into the US by overcoming all grounds of inadmissibility.”

Church’s firm, along with the Boston immigration law firm Graves & Doyle, filed the emergency federal petition Monday night eight minutes before Dehghani’s flight back to Iran was scheduled to take off. Burroughs, who temporarily blocked any action by immigration officials to deport Dehghani, scheduled a hearing in the case for 10 a.m. on Tuesday before US District Court Judge Richard Stearns.

“We have been in touch with federal officials to learn more about this case and to provide our student with the appropriate assistance to facilitate a successful return to Northeastern,” said Northeastern spokeswoman Renata Nyul.