A federal judge issued an emergency order Sunday blocking federal immigration authorities from transferring an 18-year-old Milford High School student of Brazilian nationality out of Massachusetts for at least 72 hours, court records show. The order came on the heels of a habeas corpus petition, in which his attorneys challenged the constitutionality of Marcelo Gomes Da Silva’s detention.

The Department of Homeland Security intended to detain his father, Joao Paulo Gomes-Pereira, but said Marcelo will remain in ICE custody.

District of Massachusetts Judge Richard G. Stearns also wrote that US Immigration and Customs Enforcement, and the US Attorney of Massachusetts office, must not remove Marcelo Gomes Da Silva out of the United States during that same time frame.

Stearns said this will allow the judge who will be randomly assigned the case, expected to happen this week, to “review the merits of the petition and to rule on any contested issues of jurisdiction.”

Gomes Da Silva was detained by ICE on Saturday while on his way to a volleyball practice with teammates. An immigration attorney working on his case, Robin Nice, told GBH News at least three government vehicles “swarmed” around the vehicle he was in. The high school junior has been in Massachusetts since he was 5, and is from a mixed-status family that immigrated from Brazil, she said. He’s in a high school marching band.

“This is his home. There’s nowhere else. There is no other home for him,” said Nice. “There was nothing to warrant this rash and extreme action. He just seems like a kid who’s just trying to finish up his junior year, which is frankly stressful enough.”

Nice said Gomes Da Silva has no criminal record, and said it appeared that ICE was looking for someone else at the time. She said he originally came to the United States on an F-1 visa for students as a child.

Gomes Da Silva was taken to the Burlington ICE field office, and is now detained at the Plymouth County ICE detention facility. Nice said no one who was in the car with him at the time of his detention heard federal agents give a reason for his arrest.

“It’s obviously not just this one case. It’s what this says about the ability for the federal government to operate so secretively and opaquely against the most vulnerable populations,” said Nice.

“We’re talking about kids in school with no criminal history—it’s just unfathomable and unjustifiable.“

On Monday, the Department of Homeland Security admitted it intended to detain his father Joao Paulo Gomes- Pereira, calling him a ”public safety threat.“

Assistant Secretary Tricia McLaughlin said that local authorities had alerted ICE that Joao had a habit of ”reckless driving at speeds in excess of 100 miles per hour through residential areas endangering Massachusetts residents.“

”While ICE officers never intended to apprehend Gomes-DaSilva, he was found to be in the United States illegally and subject to removal proceedings, so officers made the arrest,“ wrote McLaughlin in an email. Gomes-DaSilva remains in ICE custody pending removal proceedings, she said. The community is pushing back on the teenager’s detention.

What appeared to be hundreds of demonstrators took to the steps of Milford Town Hall on Sunday to protest the detention of Gomes Da Silva.

Heidi McKinney is a teacher at Milford High School. She says there’s a lot of fear among students following the incident.

“We’re all kind of just shocked by the whole incident, the recent incidents with ICE,” McKinney said. “Mainly a lot of fear and a lot of anger amongst the faculty and community that this happened to students that are great students.”

Milford High School’s graduation had taken place earlier in the day and multiple graduates showed up to the rally in their red gowns. One of them, Kelvyn Aquino, said he knows Gomes Da Silva.

“It’s like just one of those things where, him being in the situation he is, [it’s] just not something you would expect ever,” Aquino said. “Knowing that it could happen to him, like a person who we know, 100 percent, is a good person.”

In a statement, Gov. Maura Healey said that she was “disturbed and outraged” by the reports of the arrest.

“Yet again, local officials and law enforcement have been left in the dark with no heads up and no answers to their questions,” Healey’s statement read. “I’m demanding that ICE provide immediate information about why [Gomes Da Silva] was arrested, where he is and how his due process is being protected.”

“My heart goes out to the Milford community on what was supposed to be a celebratory graduation day,” Healey’s statement continued.

“The Trump Administration continues to create fear in our communities and it’s making us all less safe.”

The office of the US Attorney for the District of Massachusetts declined to comment on the case.