A federal judge in Boston has temporarily banned ICE agents from making arrests in or around Massachusetts courthouses.

The preliminary injunction came down today from U.S. District Judge Indira Talwani, an Obama appointee, and gives Suffolk DA Rachael Rollins and Middlesex DA Marian Ryan a big victory. Both had filed suit in federal court seeking to boot immigration officers from district courts.

Judge Talwani states in her two-page preliminary injunction that the court “ORDERS that Defendants” ICE and the acting Director Matthew T. Albence and ICE’s Todd M. Lyons in Boston along with the federal Department of Homeland Security stop any “civil immigration actions inside courthouses.”

The judge adds ICE agents cannot civilly arrest “parties, witnesses, and others attending Massachusetts courthouses on official business while they are going to, attending, or leaving the courthouse.”

The judge is allowing ICE agents to seize “individuals brought to the courthouse in state or federal custody.”

Rollins and Ryan said in April they worked with public defenders, prosecutors, and various community groups over the past year to file the suit, which alleges that the increased ICE enforcement is scaring away immigrants and therefore making it harder to bring cases.

“I’m thrilled with today’s ruling. As my staff and I closely review the decision, we look forward to continuing our vital work in courthouses across Suffolk County that will be positively impacted by today’s ruling,” Rollins said in a statement.

“I join DA Ryan, CPCS, and the Chelsea Collaborative in celebrating this moment, and look forward to addressing the media in the coming days to discuss what this important ruling means for the communities we serve,” Rollins added in a statement to the Herald.

Ryan also praised the judge’s move, saying the “federal court has recognized the irreparable harm being caused by ICE’s disruptive policy of using our courthouses to conduct civil arrests.”

She added the ruling “reaffirms that every person in our Commonwealth should be able to seek justice in our courts without fear or hesitation. The granting of this injunction is a critical step in the right direction for our Commonwealth and it should be a model for our nation.”

The DAs filed their lawsuit soon after Newton District Court Judge Shelley Richmond Joseph and a court officer were indicted on federal obstruction charges that same month for allegedly allowing an illegal immigrant to flee out a basement door at the court to elude ICE agents last year.

Rollins joined her fellow DA in lashing out at immigration agents setting up to make arrests in and around courts.

“Our criminal justice system can only function properly when people feel safe coming to court,” Rollins said. “When victims, witnesses, and defendants fear that entering a courthouse could place them at risk of immigration consequences, it prevents us as prosecutors from securing justice for the people we serve.”

An ICE official declined to comment on the injunction.

Congresswoman Ayanna Pressley said the ruling “affirms the dignity and humanity of our immigrant brothers and sisters in the 7th and throughout our country.”

She added: “Everyone in our Commonwealth, regardless of their immigration status, has a right to feel safe and secure in community, and we’ll continue to exercise every option at every level of government to protect that right.”

Developing …