Hours before the Texas Senate is scheduled to vote out a controversial state-based immigration bill, the state’s attorney general tried to ease concerns Tuesday over whether the measure could be successfully challenged in courts.

The upper chamber is expected to debate Senate Bill 4, commonly known as the anti-"sanctuary cities" bill, which would punish local government entities and college campuses that refuse to cooperate with federal immigration officials or enforce immigration laws.

If passed, the bill from state Sen. Charles Perry would allow local police to enforce immigration laws if the officer is working with a federal immigration officer or under an agreement between the local and federal agency. It would also punish local governments if their law enforcement agencies fail to honor requests, known as detainers, from federal Immigration and Customs Enforcement officers to hand over immigrants in custody for possible deportation. The punishment would be a denial of state grant funds.

During a 16-hour hearing last week, the Senate State Affairs committee heard testimony from several immigration and constitutional law attorneys who said the measure as written was fraught with legal questions and would likely be challenged in court. Several questions were raised over the impact of a current federal case in Illinois – Moreno vs. Napolitano – in which a judge ruled that detainers without a warrant are not constitutional. The case is still pending in that jurisdiction, but an attorney for the plaintiffs said they expect a final order upholding the ruling soon.

The Texas Tribune thanks its sponsors. Become one.

In an unusual move Tuesday, Attorney General Ken Paxton wrote state Sen. Joan Huffman, a Houston Republican and chair of the State Affairs Committee that voted out the bill, assuring her the bill is on solid legal standing. The letter was also sent to Perry and Lt. Gov. Dan Patrick.

“Our review of the law concludes CSSB 4 is constitutional, there are viable methods for covered entities to avoid liability regarding invalid detainers, and the remainder of the legal concerns are unfounded,” Paxton wrote.

In his letter, Paxton brought up the Moreno case, arguing that it is not valid in Texas and that the ruling will likely be reversed on appeal. Paxton also said that SB 4 would not violate an “anti-commandeering” statute in the 10th Amendment to the U.S. Constitution because ICE detainers are requests and not orders.

But opponents of SB 4 could likely use that assertion from the state's top lawyer in their effort to block the bill from becoming law, arguing that if detainers are simply requests, then a county sheriff that refused to honor them could say they aren’t running afoul of state law, as SB 4 would suggest.

Paxton also weighed in on a case out of El Paso in which the county was sued after deputies under a former sheriff boarded buses to check the immigration status of their passengers. The deputy sheriffs stopped the practice after both sides agreed to a settlement. Paxton said in his letter that if SB 4 were passed, county deputies in El Paso could still enforce state law because the agreement in the lawsuit was a settlement and not a court order. He also said that deputies are still free to cooperate with federal officers while not being required to enforce immigration laws.

In his letter, Paxton also addressed whether counties could be held liable for holding an inmate if a detainer was issued by mistake. Paxton said  counties could avoid liability by acting in good faith and working with the inmate to verify his or her legal status, and subsequently releasing that inmate.

The Senate is likely to vote on several amendments during Tuesday's floor debate, but the ultimate passage of SB 4 out of the Republican-dominated chamber is all but guaranteed. Both Patrick and Gov. Greg Abbott have called the measure a priority.

Never miss a moment in Texas politics with our daily newsletter.