Boston • A Massachusetts teen facing charges in the killing of a 17-year-old boy had been allowed to remain in the country despite being identified by police as an active member of MS-13, recently filed federal court documents show.

Homeland Security officials told an immigration judge this summer 19-year-old Henri Salvador Gutierrez should be deported to his native El Salvador because he was a "verified and active member" of MS-13 with multiple weapons-related arrests, prosecutors said in a filing last week.

But the judge deemed the information against Gutierrez inconclusive and ordered him released on June 30, just weeks before the Somerville resident and five other alleged MS-13 members stabbed Herson Rivas to death in Lynn on July 30, according to prosecutors.

Gutierrez pleaded not guilty to the charges Friday in Boston federal court and is being held without bail pending his next court date.

The case comes amid an ongoing debate over the Boston Police's gang database.

The American Civil Liberties Union filed a lawsuit against the department last month seeking more information about the secretive database, including how many people are listed on it and their demographics.

The civil rights group argued in the Superior Court lawsuit that some Central American youths are being detained and deported in large part because they've been wrongly placed in the database.

Boston Police Commissioner William Gross, in a Facebook post, lashed out at the ACLU as “paper warriors” more concerned with filing lawsuits than addressing “atrocities” committed by MS-13 and other street gangs.

Boston Police, the ACLU and Gutierrez’s lawyer didn’t immediately comment Monday.

Prosecutors say Gutierrez has been in and out of custody since arriving in the country illegally in 2014.

He was placed on the department's gang database following at least three arrests for carrying machetes and knives, for being found in possession of blue- and white-colored clothing and for sporting a "503" tattoo — all hallmarks of membership in the violent Salvadoran street gang, according to prosecutors.

But during his immigration hearing this summer, Gutierrez downplayed the details, prosecutors say.

He said the tattoo showed his pride in his homeland since "503" is El Salvador's country code. He said blue and white were the colors of his favorite soccer team and that a large knife he was found carrying in 2016 was to chop wood for grilling.

Then while in state custody on a separate firearms charge in October, Gutierrez bragged about killing Rivas because the low-level gang associate was suspected of cooperating with police, prosecutors say.

He also confirmed he and the others involved in the killing were part of MS-13, and suggested he might have committed another murder with gang members.