Last month, Greg Abbott, the Republican Governor of Texas, signed into law an anti-immigrant measure allowing local police officers to ask for the citizenship status of anyone they detain. This sort of provision—often called a “show me your papers” law—has been attempted at the state level before, most notoriously in Arizona, which passed a measure in 2010 that was subsequently blocked in federal court. In response to the new law, civil-rights groups and several Texas city governments have filed lawsuits against the measure. Earlier this week, thousands of demonstrators descended on the state capitol, in Austin, to protest on the last day of the legislative session, prompting one overwhelmed Republican representative to call Immigration and Customs Enforcement (ICE), presumably so that agents could arrest and deport members of the opposition while they stood in a gallery of the statehouse.

Texas’s law, known as Senate Bill 4 (S.B. 4), is in some ways even harsher than the one Arizona passed seven years ago: the new measure allows state authorities to punish any police chief or sheriff who tells his or her subordinates not to act as de-facto immigration agents. Violators face steep fines (a thousand dollars for the first offense and up to twenty-five thousand dollars thereafter) as well as potential removal from office. For this, and other reasons, some of the most vocal critics of S.B. 4 are leaders of the state’s law-enforcement community.

On April 28th, just after the bill passed the Texas House of Representatives, a group of police chiefs led by David Pughes and Art Acevedo—the heads of the Dallas and Houston Police Departments, respectively—wrote a public statement urging lawmakers to reconsider. “No one believes in the rule of law more than police officers,” they began, but this bill was “political pandering that will make our communities more dangerous.” In their eyes, the bill would undermine the work they’ve done to build trust in the communities they police.

Police chiefs have been speaking out against the bill since it was introduced in the State Senate, last fall. “It’s kind of amazing that, during the initial hearing, the senators had all these chiefs and sheriffs from across Texas speaking against the bill—and they totally ignored the people in law enforcement,” the El Paso County sheriff, Richard Wiles, told me this week. He said that his staff is overworked as it is. “My officers are too busy to waste their time doing another agency’s work,” he said. “If there is an officer who wants to do this, we can’t stop him under the new law. The only area where one of my officers could now be allowed to go out there and ignore his own bosses is on immigration. It’s crazy.”

Wiles believes that the law will make daily policing more difficult. “We want people to report crime, whether they’re a victim or a witness, regardless of their immigration status,” he said. If individuals are scared they’ll be deported when they come forward, key leads will dry up and crimes will become harder to solve. Acevedo, the Houston police chief, pointed out that such an outcome would affect citizens and noncitizens alike. “What if the only witness to a crime is an undocumented nanny, or the gardener, or a construction worker?” he said. “And now they don’t call in what they see!” Acevedo told me that this year, amid rising fears of a federal immigration raids, there’s been a forty-two-per-cent reduction in reports of rapes in Latino communities in the Houston area, even though the crime rate itself hasn’t declined. “That does not bode well,” he said. “Community policing is something that’s been at the core of American law enforcement for the last twenty or thirty years. It’s resulted in historically low crime rates despite population growth and despite the fact that most departments are understaffed and under-resourced. I’m not going to sit idly by while calls for service are piling up and an officer decides to go, instead, to a Home Depot to harass day laborers.”

Bills like S.B. 4 had circulated in the Texas legislature in years past, pushed by conservative state lawmakers looking to make a statement. Gregorio Casar, a member of the Austin City Council, told me, “There have been forces here in Texas that have wanted this bill and bills like it for a long time. But they weren’t serious threats. Texas on immigration policy was like the dog that barked but didn’t always bite.” That changed in January, after Donald Trump issued an executive order on so-called sanctuary cities, threatening to withhold federal money from local jurisdictions that didn’t do ICE’s bidding. There is no set definition of what makes a sanctuary city—different cities have instituted their own immigrant-friendly laws and guidelines—but the Administration was trying to compel local officials to do more to help federal immigration agents.

After Trump issued the order, Sally Hernandez, the sheriff of Travis County, Texas, publicly criticized it. “We cannot afford to make our community less safe by driving people into the shadows,” she said at the time. Abbott, the Governor, responded by promising a total "crackdown" on sanctuary cities in the state. On January 31st, in his State of the State address, he identified the war on sanctuary cities as a top policy priority. He also punished Travis County, specifically, by withholding $1.5 million in state funding. S.B. 4 had been introduced a few months earlier, and Republicans quickly rallied to the Governor’s call, passing the measure in the State Senate on February 8th.

As the House debated the bill, Steve Adler, the mayor of Austin—which is the Travis County seat—travelled to Washington with a delegation of mayors from across the country to meet with Jeff Sessions, the Attorney General. Adler and the other mayors wanted to know if the federal government considered their cities “sanctuaries.” More specifically, they wanted clarification on whether cities were legally required to comply with so-called detainer requests—when ICE asks local law-enforcement officials to hold, for an extended period of time, an undocumented person who was arrested, even if he or she hadn’t been charged with a crime. Several of the mayors present interpreted the Attorney General’s answer as a no, and they gave press conferences after the meeting to announce that they’d left feeling reassured. “I walked out of that meeting saying, ‘O.K., this is what the Attorney General is telling me,’ ” Adler recalled. He thought that having clarification from the Justice Department would slow down the legislative push in his home state. But it didn’t; neither did the ruling of a federal judge, who blocked the President’s executive order for unfairly punishing sanctuary cities.

I asked Cecillia Wang, the deputy legal director of the A.C.L.U., which has also filed suit against the law, how S.B. 4 ranks among other infamously harsh anti-immigrant laws that have been passed in recent years, like Arizona’s. She told me that she sees Texas’s law as especially harmful because it puts local officials in a significant legal bind. Over the years, people have sued local police departments for holding them without a valid warrant at the behest of ICE, and the courts have ruled that municipalities bear legal liability in such cases. “The various detainer lawsuits over the past several years make it clear that this law is a bad idea, and yet the Texas legislature and the Governor shoved it down their own police chiefs’ and sheriffs’ throats,” Wang said. “It’s stripping away their ability to do their job as they see fit, which is to protect public safety.”

Acevedo, the Houston police chief, saw an irony in this. “Texas politicians always complain that Washington is trying to dictate to them how to do things,” he told me. “Now they’re turning around and doing the same thing to the cities in their own state.”