BOSTON (Reuters) - Massachusetts’ top federal prosecutor defended a decision by immigration authorities to arrest a Chinese citizen at a courthouse this week after she was sentenced to probation, a move that outraged the judge overseeing her case.

FILE PHOTO: U.S. Attorney Andrew Lelling speaks to reporters at his office in Boston, Massachusetts, U.S., January 24, 2018. REUTERS/Nate Raymond/File Photo

The judge had expressed concern that the presence of U.S. Immigration and Customs Enforcement (ICE) agents at court proceedings could scare off potential witnesses who faced immigration issues. Immigrant advocates have raised similar worries about courthouse arrests under Republican President Donald Trump, whose administration is taking a hard line in restricting immigration.

U.S. Attorney Andrew Lelling in a statement late Thursday said the ICE agents who took Xinyan Wang, 27, into custody outside Boston’s federal courthouse were “doing their jobs: enforcing federal law.”

“Their efforts to protect the public should be applauded, not criticized,” said Lelling, a Trump appointee.

The arrest occurred after U.S. District Judge Indira Talwani on Wednesday sentenced Wang to 12 months of probation for using a fake Chinese passport to take a graduate school entrance exam for another Chinese national.

“I see no reason for places of redress and justice to become places that people are afraid to show up,” Talwani said.

Michael Shea, the acting special agent in charge of Immigration and Customs Enforcement’s Homeland Security Investigations in Boston, expressed gratitude for Lelling’s support.

Shea said his agency’s mission “may under certain circumstances require enforcement actions to be carried out in courthouse surroundings.”

In January, Wang pleaded guilty to charges she used a counterfeit Chinese passport and a bogus visa to pose as someone else to take a Graduate Record Exam, or GRE, in October.

Wang was paid to take the GRE or the TOEFL, the English-language exam used to assess foreign applicants, five other times under assumed names, according to court papers.

Wang was previously a graduate student at Lehigh University in Pennsylvania, but after her adviser’s laboratory’s funding ran out, she enrolled in a community college to keep her student visa, according to her lawyer, Syrie Fried.

She has said that Wang is now seeking asylum as she fears reprisal from the people who made the documents she used.

Fried on Friday said Lelling’s statement missed the point of Talwani’s concern, namely that courthouse immigration arrests expose the court to people questioning its neutrality.

“Instead the court becomes vulnerable to being perceived as assisting law enforcement in making arrests, because people generally come to the court only when they are under a legal compulsion to do so,” Fried said.