PORTLAND, Maine — Immigration and Customs Enforcement agents on Thursday seized a Somali man believed to be an asylum seeker inside a Portland courthouse, after he pleaded not guilty to a misdemeanor charge, according to his lawyer and court security.

Abdi Ali, 28, had just finished meeting with his attorney at the Cumberland County Superior Court after being arraigned on a drunk driving charge when three ICE agents grabbed him, pushed him against the wall and roughly handcuffed him before walking him out of the court, said lawyer Tina Heather Nadeau, who was advising him on the charge.

Nadeau and other lawyers who work in immigration said that Ali’s arrest was the first time they were aware of immigration agents detaining someone in a Maine courthouse. The incident appears to signal that President Donald Trump’s more aggressive immigration enforcement is being implemented here.

“I’d never seen this in Maine but I guess it’s here now,” said Nadeau.

ICE has come under criticism in recent months for its use of courthouse arrests in other parts of the country. And Maine immigration and civil rights activists worry that the tactic will discourage people from showing up to their court dates and undermine the justice process.

“This is extremely troubling because the courts are supposed to be a safe place where people can access justice,” said Susan Roche, executive director of Immigrant Legal Advocacy Project.

Sgt. Keith Jensen, of the Judicial Marshals, said that ICE agents had come to the courthouse and told him that they would be detaining someone, before taking Ali into custody between 9 and 9:30 a.m.

Nadeau was speaking with Ali in a private conference room at the courthouse Thursday morning, as part of her occasional work representing people brought up on minor charges, she said. As they were talking, a man burst into the room and said he needed to talk to Ali, Nadeau said.

Startled, Nadeau recalled advising Ali not to say anything and telling the man to leave the room. When the pair exited the conference room, three men identified themselves as ICE agents and arrested Ali, Nadeau said.

“It is very disturbing that someone coming to the courthouse for his scheduled court date and to get legal counsel is being dragged out in handcuffs,” said Nadeau, who is not representing Ali in any immigration case.

“Ali has an extensive criminal history that includes numerous misdemeanor convictions, including two convictions for assault,” according to a statement from ICE spokesman Shawn Neudauer.

Neudauer said that Ali “resisted arrest, both verbally and physically” — a claim that Nadeau denied. Ali is being held at the Cumberland County Jail, according to a jail official.

Asylum seekers typically enter the U.S. legally but may have lost their legal status in the country while the often lengthy process of applying for asylum is pending. Ali’s legal status was not clear from interviews or court documents. Under the Trump administration, ICE has done away with the Obama-era policy to focus on serious criminals.

Before being arrested, Ali had expressed uncertainty about his immigration status, first saying that he was a citizen and then amending that to say he was an asylum seeker, according to Nadeau.

The courthouse arrest sparked sharp criticism among elected officials and activists in Portland.

“Lurking at courthouses to arrest immigrants, is shortsighted and not the best way to implement immigration laws,” City Councilor Pious Ali, himself an immigrant, wrote on Facebook. “Acts like this will negatively affect the relationship between local law enforcement and the immigrant community and not in the best interest of our community and city.”

The ACLU of Maine said that it expects people in the legal community, regardless of political opinion, to stand against arrests like Ali’s.

“People need to feel that they can come to court and tell a judge what happened to them without fear of government attack,” ACLU Legal Director Zach Heiden. “That’s true for people accused of crimes, people who are victims of crimes, and people who are witnesses to crimes.”

Mary Ann Lynch, spokeswoman for the State of Maine Judicial Branch, said this was the first time that she had heard of ICE arresting people in Maine courts.

“We don’t have a policy right now,” said Lynch. “This is a first-time event for us, so we’ll be looking at the situation.”

ICE has used similar tactics elsewhere, including in New England.

In California, the chief justice of the state supreme court criticized ICE agents for using courthouses as “bait,” according to the Washington Post, and said they were “stalking” immigrants “who pose no risk to public safety.”

In March, ICE agents arrested five people who were at the Lawrence, Massachusetts office of US Citizenship and Immigration Services for scheduled appointments, the The Boston Globe reported. Three of those people were seeking green cards, according to public radio station WBUR.

Ali is likely at the beginning of the often drawn out process of working through the immigration court system, according to Roche, of ILAP. ICE usually holds people at the Cumberland County Jail for a couple days before moving them to other facilities in New Hampshire or Massachusetts, she said.

The first step in adjudicating a deportation case is to determine whether someone is eligible to get out on bond. In Maine cases, a judge in Boston usually makes that decision after a teleconference hearing, and considers whether the defendant is dangerous or a flight risk, Roche said.

People in deportation cases have the right to a lawyer, but unlike in criminal matters, the government doesn’t need to provide them with one.

BDN staff writer Beth Brogan contributed to this report.