AUSTIN, Texas (Reuters) - Texas Republican Governor Greg Abbott signed into law on Sunday a measure to punish “sanctuary cities,” despite a plea from police chiefs of the state’s biggest cities to halt the bill they said would hinder their ability to fight crime.

The Texas measure comes as Republican U.S. President Donald Trump has made combating illegal immigration a priority. Texas, which has an estimated 1.5 million illegal immigrants and the longest border with Mexico of any U.S. state, has been at the forefront of the immigration debate.

“As governor, my top priority is public safety, and this bill furthers that objective by keeping dangerous criminals off our streets,” Abbott said in a statement. The law will take effect on Sept. 1.

The Republican-dominated legislature passed the bill on party-line votes and sent the measure to Abbott earlier this month. It would punish local authorities who do not abide by requests to cooperate with federal immigration agents.

Police officials found to be in violation of the law could face removal from office, fines and up to a year in prison if convicted.

The measure also allows police to ask people about their immigration status during a lawful detention, even for minor infractions like jaywalking.

Any anti-sanctuary city measure may face a tough road after a federal judge in April blocked Trump’s executive order seeking to withhold funds from local authorities that do not use their resources to advance federal immigration laws.

Slideshow ( 2 images )

Democrats have warned the measure could lead to unconstitutional racial profiling and civil rights groups have promised to fight the Texas measure in court.

“This legislation is bad for Texas and will make our communities more dangerous for all,” the police chiefs of cities including Houston and Dallas wrote in an opinion piece in the Dallas Morning News in late April.

They said immigration was a federal obligation and the law would stretch already meager resources by turning local police into immigration agents.

The police chiefs said the measure would widen a gap between police and immigrant communities, creating a class of silent victims and eliminating the potential for assistance from immigrants in solving or preventing crimes.

One of the sponsors of the bill, Republican state Representative Charlie Geren, said in House debate the bill would have no effect on immigrants in the country illegally if they had not committed a crime.

He also added there were no sanctuary cities in Texas at present and the measure would prevent any from emerging.