BOSTON — Key police associations are now on board with compromise legislation that will support undocumented immigrants and work to improve trust between police and immigrant communities.

The Massachusetts Major City Police Chiefs Association, members of the Massachusetts Chiefs of Police Association Executive Committee and the MCOPA Legislative Committee voted unanimously to endorse new language to the “Safe Communities Act,” sponsored by state Sen. Jamie Eldridge and state Rep. Juana Matias.

The new language allows for what MMCC calls “a more effective balance of building and improving trust in our respective communities.”

The modified version requires law enforcement to honor Immigration and Customs Enforcement detainment requests for up to six hours in cases where detainees have previous convictions for serious offenses like sexual assault, abuse, drug trafficking, human trafficking or domestic violence. This also applies to those arrested on terrorism by the federal-state Joint Terrorism Task Force.

Dentainees may be held for 48 hours currently.

The Department of Correction would be required to provide ICE release dates for inmates who commit violent crimes.

The original Safe Communities Act would have prohibited state and local authorities from asking about a person’s immigration status and would have outlawed police from holding immigrants on an ICE detainer if they had no reason to do so.

Eldridge, an Acton Democrat, and Matias, a Lawrence Democrat, worked with key police chiefs to redraft the bill.

Last July, the state Supreme Judicial Court ruled that law enforcement cannot detain people based on a federal request. The ruling does not address other forms of partnership, like sharing information about the location of undocumented immigrants.

The redrafted version of the bill bans agreements that “deputize” local police and sheriffs, outlaws state support for a “Muslim registry” and safeguards due process rights for immigrants detained for civil violations.

“We believe that this newly modified bill is a commonsense, policy prudent, and safety-orientated approach to addressing the existing ‘gap’ in the state of the current law in this commonwealth,” said the police association in a statement.

Eldridge said making a distinction between local law enforcement and federal agents will restore trust among immigrant communities.

“In a city like Lowell, those immigrants think that the local police officer is engaged in enforcing immigration law, they’re not going to report a crime or domestic violence,” he said. “They won’t have that trust with police. That’s a main mission of this bill is to restore that trust.”

Matias, one of 14 candidates running for the Democratic nomination in the 3rd Congressional District, said President Donald Trump’s immigration policy instilled a new sense of fear among local immigrants. In hearings on the bill, hundreds of doctors, social workers and law enforcement testified that immigrants are not coming to appointments or calling police for help out of fear.

“They feel that they are jeopardizing their families who are mixed status,” said Matias, who comes from an immigrant family. “We need to let them know that our local law enforcement is here for their safety.”

Matias tapped Chelsea Police Chief and MMCC President Brian Kyes to work alongside legislators.

“We think that overall, this bill strikes a fair balance,” Kyes said. “Right now, the status quo since the Lunn decision is a dangerous situation here in Massachusetts.”

Matias said some House colleagues are having a change of heart now that law enforcement is behind the bill. The original Eldridge-Matias bill was sent to study by the Legislature’s Committee on Public Safety and Homeland Security, which is usually the end for a bill. Eldridge and Matias said they are working with colleagues to get it passed before this session ends in July.

The MMCC is made up of representatives of the 40 largest departments in the state, which serve 40,000 people or more. MCOPA is made up of 351 chiefs and 50 or so university police chiefs.

Lowell Police Superintendent William Taylor, an MMCC member, said the bill is “common sense.”

“We think it’s a balanced approach to a dilemma we find ourselves in currently,” he said. “Currently, we have a public safety gap and that’s a very bad situation for public safety in Lowell and the commonwealth in general.”

Fitchburg Police Chief Ernest Martineau said the bill’s balance is crucial. As a detective, Martineau said he witnessed people in the community hold back from reporting crimes like domestic violence because of a lack of trust in police.

“We’re a diverse community and it’s something we pride ourselves on,” he said. “It’s nice to see law enforcement come together with our elected officials, take a bill everybody feels is important and come to a compromise that enhances public safety.”

Eldridge filed versions of this bill, the “Trust Acts,” in the past three legislative sessions. The previous versions aimed to make Massachusetts a “sanctuary state” to protect undocumented immigrants.

Back then, William G. Brooks III, president of the Massachusetts Chiefs of Police Association, told the Daily Hampshire Gazette that the legislation was unnecessary. He said he wants to see the changes Trump planned to make to federal immigration policy before choosing a statewide response.

The Safe Communities Act is directly opposed of legislation filed by Billerica Rep. Marc Lombardo last year, which aimed to cut funds to so-called “sanctuary cities.”

Lombardo told The Sun in November that he proposed the legislation because undocumented immigrants cost the commonwealth around $2 billion, according to the Federation for American Immigration Reform. Trump signed an executive order threatening to withdraw funding from sanctuary cities, which was struck down in by a federal judge in San Francisco last April.

During the first year of the Trump administration, arrests by ICE officers surged 40 percent, according to agency data. However, the biggest jump in arrests has been of immigrants with no criminal convictions. ICE made 37,734 noncriminal arrests in the government’s 2017 fiscal year, more than double the previous year.

Eldridge said he wants immigrant communities to feel comfortable going to local police without fear of deportation.

“These are hardworking families, paying taxes and giving back to their community,” he said. “They’re being sent back to a country they hardly know. They’re being targeted, and I don’t think Massachusetts wants to part of Donald Trump’s mass deportation agenda.”

Gov. Charlie Baker, a Republican who opposed the original bill, filed a bill to allow local law enforcement to honor requests from ICE to detain individuals already in custody on criminal charges or for sentences related to past violent crimes.

Baker’s bill would allow police to honor requests from ICE to hold an individual for up to 12 hours (not six) if that person has engaged in or is suspected of terrorism, gang-related crime, a felony, domestic violence, sexual abuse and human trafficking.

Baker said he would have to read the redrafted bill before commenting and reiterated his concerns with the original bill, the State House News Service reported.