Hector Ramirez, now 22, was arrested by US Customs and Border Protection in July 2010 in Texas, court records show. Two years later, an ex-girlfriend took out a restraining order against him. In 2014, Chelsea police charged the suspected MS-13 gang member in a vicious knife attack on a teenager and the robbery of a man at gunpoint — an arrest that would customarily have alerted immigration authorities, who, critics say, could have detained him.

CHELSEA — An alleged gang member indicted last week in the fatal shooting of a mother of three in Chelsea had arrived in the United States illegally as a teenager and was charged with other violent crimes, raising questions about why US immigration officials did not detain or deport him before the woman’s death.


A few months later, Katerin Gomez was killed by a gunshot to the head.

“This is a classic case of when a detainer really should be issued and would have been a huge help to public safety and might have saved this woman’s life,” said Jessica Vaughan, director of policy studies for the Center for Immigration Studies.

Vaughan raised the Ramirez case before the House Judiciary Committee last yearwhen testifying about immigration enforcement. “The victims can be anyone. And everyone in the community deserves the protection that this kind of enforcement provides.”

Federal immigration officials had no explanation this week for why they did not detain Ramirez, also known as Hector Ramires. He is among 56 people indicted on federal criminal charges, including the murders of five people and attempted murders of 14, last week in a takedown of the East Coast chapter of the MS-13 international street gang, which has terrorized immigrant cities in Massachusetts.

Several of the accused are immigrants here illegally, the US attorney’s office has said. Many, if not all, of the victims are also immigrants.


Because the US immigration system’s records are largely secret, the Globe could not independently review Ramirez’s immigration case or any others. Immigration officials have said that disclosing such records would violate immigrants’ privacy. But the secrecy also allowed Ramirez’s status to remain unclear to the public when federal officials announced last week’s highly publicized raids.

Shawn Neudauer, spokesman for Immigration and Customs Enforcement, or ICE, declined to comment Thursday because the criminal case against Ramirez is pending. Asked to comment on the civil immigration case only, he also declined. “Please refer all future questions to the US Attorney’s Office,” he said in a statement.

The US Attorney’s office declined to comment on the immigration case.

Ramirez is among tens of thousands of unaccompanied minors — mainly boys from Central America — who have flooded the southern border in recent years.

Typically they are turned over to the US Department of Health and Human Services for placement with relatives or guardians. An HHS spokeswoman said Homeland Security officials fingerprint and perform background checks on the minors before referring them for placement. She declined to comment on Ramirez because of his pending case in federal court.

According to Suffolk Superior Court records, the US Customs and Border Protection agency arrested Hector Eduardo Ramirez Diaz on July 21, 2010, in Texas and charged him with being in the United States illegally. It is unclear if he attended an immigration court hearing.


The US Customs and Border Protection agency declined to comment this week because Ramirez was a minor when they arrested him.

After the 2010 arrest, Ramirez next resurfaced in Massachusetts criminal courts in 2012, when an ex-girlfriend sought a restraining order against him in Chelsea.

Then, two years later, Chelsea police arrested Ramirez in a knife attack on a teenager in March 2014 and an armed robbery the following month, according to court records. He allegedly held a gun to a man’s head and repeatedly asked, “Should I shoot him?”

Chelsea police arrested Ramirez in April 2014 at an area hospital where he was seeking treatment for stab wounds he received in a separate incident. Police said he confessed on videotape to a robbery in his native Honduras and to the April 2014 robbery in Chelsea, though he claimed the gun was fake.

“I did do it,” he allegedly told police, according to court records. “I robbed and assaulted him but I don’t know why I did it.”

He was indicted in Suffolk Superior Court on armed robbery and other charges. Immigration officials receive automatic notifications when police fingerprint someone who could be eligible for deportation, so critics say the agency should have known when Ramirez was arrested in 2014.

On Oct. 7, 2014, Clerk-Magistrate Anne Kaczmarek released Ramirez on personal recognizance. Prosecutors had argued for bail, said Renee Algarin, a spokeswoman for the Suffolk County district attorney’s office.

It was 11 days before the fatal shooting of Gomez — a crime that was included in the federal indictment of Ramirez and dozens of other gang suspects last week.


Critics say ICE could have detained Ramirez as a public safety threat, especially since he was a suspected member of one of the largest and most violent criminal enterprises in the United States, whose motto in Spanish is “Kill, rape, control.”

On Oct. 18, 2014, just after midnight, Ramirez was walking down the street in Chelsea with Brayan Galicia, an 18-year-old Guatemalan with a string of arrests who was also indicted on Friday in federal court.

According to police, they got into a confrontation with a group outside Katerin Gomez’s window and a single shot was fired, killing Gomez.

Vaughan said she fears that immigration authorities are not detaining people like Ramirez because of intensifying pressure from advocates for immigrants to curb immigration enforcement. “You shouldn’t have to wait for someone like that to hurt someone else before they get picked up,” Vaughan said.

But advocates for immigrants say they aim to prevent police from helping ICE deport immigrants with relatively minor brushes with the law, saying such cooperation makes the immigrant community afraid to call police for help. In recent months, Boston immigration officials have targeted a Brazilian truck driver with no criminal record and a Guatemalan father with a 21-year-old drunk driving conviction who had pleaded to stay with his family in Lynn.

On Thursday a state legislative committee considered a bill that would limit police cooperation with ICE to prevent otherwise law-abiding immigrants from getting deported.


Advocates said that, under the bill, ICE would still be able to detain serious criminals — even if they make bail on their criminal charge.

Maria Sacchetti can be reached at maria.sacchetti@globe.com.