Federal immigration officers detained a Mexican citizen inside a Brooklyn courtroom Tuesday, officials said.

"Instead of following OCA — the Office of Court of Administration — requirement that court officers and court staff not assist ICE, instead they are, they're opening the door and letting them use secure areas to detain our clients and take tour clients into custody," a lawyer said.

Immigration and Customs Enforcement (ICE) officials said Genaro Rojas-Hernandez was in Brooklyn Criminal Court for a domestic violence case.

Deportation officers were summoned to the courtroom at the end of the hearing, and took the man into custody.

Rojas-Hernandez's lawyers and supporters rallied outside the courthouse, demanding justice for their client.

"This is denying due process both to the defendants and victims when ICE comes here and takes the client — takes them to a detention center," another attorney said.

Acting Brooklyn District Attorney Eric Gonzalez released a statement on Twitter following the arrest, saying in part, "Today's ICE arrest during a hearing on a serious domestic violence case denied due process for both victim and defendant. Such actions defer victims from reporting abuse and threaten public safety."