Several immigration officers arrested a man during a controversial round up at Brooklyn Criminal Court. View Full Caption Brooklyn Defenders Services

BROOKLYN — Three of the four men seized by immigration agents outside Brooklyn Criminal Court last week had no known prior criminal records, according to law enforcement sources, despite claims by Immigration and Customs Enforcement that they were members or affiliates of a violent street gang.

The arrests Thursday by plainclothes ICE agents have advocates and defense attorneys worried that ICE’s sweeping authority undermines New York’s status as a so-called Sanctuary City, because it showed that deportation arrests can happen following even the most minor crimes.

► READ MORE: ICE Agents Target Brooklyn Criminal Court

The four men, Sergio Perez, Juan Villa, Fredy Rosas and Eduardo Romero, all undocumented Mexican nationals, were detained Thursday before appearing in court on misdemeanor trespass charges stemming from an arrest by NYPD officers in Sunset Park in July.

Only Romero — who was also hit with a weapons charge for carrying a switchblade in his backpack that night — had a criminal record, having pleaded guilty and done community service for a 2013 misdemeanor assault case.

Perez, Villa and Rosas, however, had no known records, a source said.

The men were arrested on July 29 after a neighbor called 911 about a loud party on the roof of 512 48th St. in Brooklyn, an apartment building that appeared to be under construction last week.

When police arrived, they found the four detainees along with three other men hanging out and drinking beer on the roof and arrested all of them. One of the men was hit with a felony weapons charge after police spotted him ditching a handgun, and another was found with crack-cocaine residue, according to law enforcement sources.

Perez, Villa, Rosas and Romero were not charged in connection to the handgun or the drugs.

According to ICE, all four men detained last week were members or affiliates of the "Niños Malos" street gang, but a city law enforcement source said he had no information to confirm the allegation.

The four detainees admitted to being either members or affiliates of the gang upon their arrest by ICE agents, according to ICE spokeswoman Rachel Yong Yow. She declined to go into detail about the extent of any gang involvement the men had, and refused to say whether the agency suspected gang membership prior to the arrests Thursday.

The label of gang affiliation in particular stood out to advocates as a broad accusation that nonetheless carries the power to ensnare undocumented immigrants in ICE dragnets, according to Anthony Posada, an attorney with the Legal Aid Society.

“In the criminal context, the label of being a gang member is completely destructive to the case, but at least the attorney can fight back,” Posada said. “In immigration court, the stakes are much higher: It's grounds for removal."

► READ MORE: Advocates Fear Anti-Gang Bill Uses MS-13 'Boogeyman' To Criminalize Minority Youth [Gothamist]

The NYPD is known to keep data on gangs in the city using a form called a gang entry sheet, which police use to document the criteria for gang membership or affiliation. A person may be considered a gang member if he or she associates with a known gang member or wears colors associated with a gang.

“Accusations of gang affiliation are often unverified, and can be based simply on being friends on Facebook with someone who’s in a gang,” said Scott Hechinger, senior staff attorney and director of policy at Brooklyn Defender Services. “It winds up trapping people who have absolutely no involvement in a gang.”

Entry form used by the NYPD to log gang information. Provided by Brooklyn Defender Services.

The Department of Homeland Security has been known to monitor social media accounts as an enforcement tactic, according to an April advisory from the National Immigration Project of the National Lawyers Guild.

Representatives of the NYPD and two spokesmen for the mayor, Austin Finan and Seth Stein, who deal with NYPD issues and immigration, respectively, did not respond to repeated questions about whether or not the NYPD shares its gang database with federal authorities.

Last week's raid also highlighted how little the city can do when ICE sets its sights on immigrants the agency wants to detain or deport.

There is no law that prohibits agents from public buildings, but agents alert court officers under an agreed-upon policy.

When the agents went into the courthouse Thursday morning, they notified a court officer at the entrance, but he failed to follow protocol by not notify higher-ups, according to Lucian Chalfen, a spokesman for the Office of Courts Administration.

That officer was subsequently “reeducated as to [OCA] protocols,” according to Chalfen.

The presence of plainclothes ICE agents on the court’s eighth floor — where low-level arraignments take place — also came as a surprise to the District Attorney’s office, according to a law enforcement source.

A criminal court supervisor from the DA’s office was alerted to the presence of ICE agents through the grapevine and approached the agents to say that if they were planning to arrest anyone, the DA wanted to know about it.

But according to the source, the agents refused to identify themselves to the supervisor and left shortly thereafter. A DNAinfo reporter witnessed part of this exchange, including the supervisor identifying himself and at least one agent outright denying that he was an ICE agent.

In the wake of the raid, acting Brooklyn DA Eric Gonzalez called ICE's actions "outrageous" and warned of the practice scaring undocumented immigrants, defendants and plaintiffs alike, away from the justice system.

Statement from Acting Brooklyn DA Eric Gonzalez regarding continued ICE raids in courts: pic.twitter.com/E4GF6smxC3 — Eric Gonzalez (@BrooklynDA) September 15, 2017

With the four men in ICE custody, it could be weeks until lawyers are able to meet with them, according to Hechinger, whose organization has funding from the city to represent detainees. He said Brooklyn Defender Services might be called upon to defend the men in immigration proceedings, but said until then they’re essentially off the grid.

“In about three to four weeks, when these individuals make their first appearances in deportation proceedings, we may be assigned their cases,” Hechinger said. “We’re keeping an eye out.

“Until then, these men are stuck in immigration detention… in a black hole."