SAN JOSE — A homeless man arrested Monday in connection with the stabbing death of a San Jose woman at her home last month was an undocumented immigrant who had been ordered detained by federal authorities nine times, officials said Tuesday. But the man, who had multiple convictions for misdemeanor and felony offenses, was released from Santa Clara County Jail twice in the months leading up to the killing.

On Tuesday, San Jose Mayor Sam Liccardo blasted the county’s policy of not honoring federal immigration detention orders at the jail, saying it “undermines public safety and violates common sense.”

San Jose police Chief Eddie Garcia joined with Liccardo and Sheriff Laurie Smith in criticizing the policy. At a news conference, Garcia said he was well aware of the ways in which the case probably would be politicized amid a heated national debate over immigration and local sanctuary” policies meant to protect undocumented residents from federal authorities.

But, Garcia said, there was a distinction between protecting and embracing “otherwise law-abiding undocumented residents” and policies that he said “shield admitted gangsters or violent criminals.”

“When we have violent or serious offenders that are preying on our community, we must have the ability to protect our residents,” Garcia said.

Dave Cortese, a member of the Santa Clara County Board of Supervisors that set the policy, said in a statement that the county cannot legally hold undocumented individuals for U.S. Immigration Customs and Enforcement without a warrant or a judicial order unless they have been charged with a crime or a judge orders their detention.

“This was adjudicated by the federal courts at the highest level,” said Cortese, referring to the county’s 2017 lawsuit against President Donald Trump challenging an executive order that cut off federal funding to jurisdictions with sanctuary policies. “Incidentally, the mayor and San Jose City Council supported our position by filing amicus briefs with the courts. If ICE wants a hold or interview or custody they simply need a warrant. Otherwise we cannot jail somebody without current criminal charges pending.”

Police arrested 24-year-old Carlos Eduardo Arevalo-Carranza on Monday in the killing of 59-year-old Bambi Larson, who was found dead in her home on Knollfield Way on the afternoon of Feb. 28.

Arevalo-Carranza, a native of El Salvador, had been living in the country illegally, and was the subject of at least nine “detainers” from U.S. Immigrations and Customs Enforcement since 2016, according to Erik Bonnar, acting director of the agency’s San Francisco field office.

Under those detainers, local law enforcement agencies hold immigrants for up to two days until ICE agents can take custody of them. The county has not honored them since 2011.

Garcia said Arevalo-Carranza had been arrested several times in the county, most recently in January on charges of possession of methamphetamine and drug paraphernalia. He had also been arrested in October. But Garcia said Arevalo-Carranza was never turned over to ICE because of the county’s policy of not honoring federal detention orders.

Bonnar criticized the county in a statement Tuesday, writing that it “allowed Arevalo-Carranza back on the streets to reoffend.”

“These sanctuary policies have unintended, but very real, and often tragic consequences to public safety,” Bonnar said.

Liccardo said he would like the county to honor ICE detention orders for people arrested for “prior first-degree home burglaries and other ‘strike’ offenses.” Garcia did not describe specific changes he would like to see to the policies, but said he believes local law enforcement should be involved in the conversations.

Smith, who as sheriff runs the jail, said Arevalo-Carranza should have been held for federal officials.

“It has been my long-standing position that all undocumented immigrants who are a serious or violent felons, should be held for ICE evaluations,” Smith said.

Cortese, the county supervisor, said the county has for many years provided ICE with “complete real-time computer data” about such individuals in their custody and their scheduled release dates.

“Generally, despite having this information, ICE does not show up to take custody in a timely manner to avoid release into the community,” Cortese said. “That handoff could otherwise take place seamlessly if ICE would merely show up at or prior to the release date.”

Police have not been able to determine any connection between Arevalo-Carranza and Larson, Garcia said, though they believe he “stalked” the quiet South San Jose neighborhood where the crime occurred.

Larson’s son had gone to check on his mother on the afternoon of Feb. 28 after he said coworkers told him she had not shown up to work that day. He found her covered in blood in her bedroom and called police about 1:45 p.m.

Garcia said police analyzed more than 460 hours of surveillance footage in their hunt for a suspect.

“From a public safety perspective,” he said, “the cameras in that neighborhood really truly helped us get to where we’re at today.”

DNA collected from Arevalo-Carranza on Sunday, when he was arrested for an unrelated charge and released, was ultimately used to link him to the killing, said Garcia, adding that Larson’s cellphone and tablet were also found with his personal property.

Prosecutors expect to charge Arevalo-Carranza with murder, a spokesman for the Santa Clara County District Attorney’s Office said, with an arraignment hearing scheduled for Thursday.