(CNN) An Iranian student planning to attend Northeastern University was flown out of the United States despite an emergency stay, and Customs and Border Protection said it was not aware a court had temporarily blocked the student's removal.

Mohammad Shahab Dehghani Hossein, 24, was refused entry to the United States on his student visa when he arrived at the Boston Logan International Airport on Sunday. While he was detained, a Massachusetts district court judge granted him an emergency stay but he was deported Monday night, said his attorney, Kerry Doyle.

Customs and Border Protection was "unaware of the issuance of any court order barring the removal of the subject from the United States" when Dehghani boarded the flight and the aircraft's doors had closed, the agency said in a statement.

Judge Allison D. Burroughs ordered Monday that Dehghani's removal be stayed for 48 hours or until further order of the court, according to the court docket. A federal detention hearing for Dehghani was scheduled for Tuesday morning.

Tuesday, Judge Richard Stearns said the case is now "moot" because Dehghani was "never admitted into the United States, is no longer in custody, and the court does not have jurisdiction to order his return," CBP said in a statement.

Read More