WASHINGTON — President Trump upended Republican efforts to negotiate an immigration bill that could pass the House, saying he would not support a measure that Speaker Paul D. Ryan (R-Wis.) had painstakingly cobbled together over the last week.

Hours after throwing the House Republican caucus into turmoil, the White House issued a statement saying, in effect, that the president had been confused.

Ryan’s plan to have the House vote next week on two billshas been — a hard-line measure that even its supporters say probably does not have the votes to pass the House, and a second, compromise measure that he had negotiated in hopes of gaining agreement among Republican factions.

Asked about the two bills during a “Fox & Friends” interview Friday morning, Trump shot down Ryan’s plan.

“I’m looking at both of them. I certainly wouldn’t sign the more moderate one,” he said. “I need a bill that gives this country tremendous border security. I have to have that.”

House Republican leaders expressed puzzlement at Trump’s reaction — White House officials had been closely involved in Ryan’s negotiations — and said they were shelving their plans to gauge support for the bill among their members until they could get clarification from the White House.

White House officials struggled to come up with an explanation, and for hours declined to comment on the record.

Late in the afternoon, White House Deputy Press Secretary Raj Shah issued a statement saying that Trump “fully supports” both bills.

“In this morning’s interview, he was commenting on the discharge petition in the House,” Shah said, referring to an effort pushed by moderate Republicans to force a vote on a bipartisan immigration bill. That effort failed Wednesday.

Among other provisions, Ryan’s bill would have taken direct aim at California’s so-called sanctuary laws. Under the bill, jurisdictions that decline to cooperate with federal immigration enforcement could be held liable for failing to detain people in the U.S. illegally for deportation proceedings.

If local law enforcement officials did not comply with an Immigration and Customs Enforcement request to hold an immigrant who is in the country illegally, and that immigrant was released and later committed rape, murder or sexual assault of a minor, the victim or the victim’s family would be allowed to sue the jurisdiction, according to a draft of the bill released Thursday.

The bill would also curb the administration’s policy of separating families when they are apprehended trying to cross the border illegally. Instead, it would establish a policy of keeping parents and children together in family detention centers. Immigrant advocates have denounced those centers as harsh and sometimes dangerous.

Trump, in his interview, continued his effort to falsely portray family separation as something mandated by law, rather than chosen by his administration as a policy designed to deter people from trying to enter the country illegally.

“I hate the children being taken away,” he said. “That’s the law, and that’s what the Democrats gave us,” he said. No law requires separation of family members.

Trump frequently has railed about violent crimes committed by people in the country illegally during the 2016 campaign, most notably the case of Kathryn Steinle, a San Francisco woman killed two years ago by a Mexican man who had been deported several times.

A federal judge in California ruled that Steinle’s parents could not sue San Francisco for failing to hold the man at an immigration official’s request.

The shooter ultimately was acquitted of homicide after a jury heard testimony that the gun may have fired accidentally. Trump denounced the result, tweeting about the “disgraceful verdict in the Kate Steinle case! No wonder the people of our Country are so angry with Illegal Immigration.”

The proposal could raise serious constitutional issues. It would allow suits not only against local governments, but also against states, like California, that have sanctuary laws. The Constitution’s 11th Amendment typically forbids suits against a state unless it consents to waive its sovereign immunity.

In a statement, a Republican familiar with the bill’s design said it would allow suits against the states and bypass sovereign immunity under Congress’ power to enforce the 14th Amendment’s broad guarantee of “due process of the law.” Conservatives have typically denounced such expansive readings of the due process clause’s reach.

Margaret Peters, an associate professor of political science at UCLA, said that “given his rhetoric on this issue,” the proposed change “feels like total political theater.”

California Atty. Gen. Xavier Becerra denounced the bill as “a charade” with “a rehash of old unworkable ideas, showing a lack of guts and respect for our Constitution.”

The bill, also includes $25 billion for a border wall as well as cuts to legal immigration. In exchange, it would offer legal status for people who came to the country illegally as children.

The sanctuary state section of the bill wasn’t trumpeted along with the other provisions.

Trump often denounced sanctuary policies during the campaign, and a crackdown on money for sanctuary jurisdictions was one of his first actions as president. His efforts to cut funding have been blocked by the courts.

The bill would also for the first time put into law a time frame for how long cities, counties and states should hold prisoners at ICE’s request — up to 96 hours past their scheduled release.

Jurisdictions that comply with such “detainer” orders would be acting under federal authority and could not be sued for holding prisoners past the end of their sentences, the bill says.

Immigration and Customs Enforcement frequently asks cities or counties to detain prisoners after they have served their sentences so they can be picked up for deportation, and many do so.

But multiple federal courts have said these detainers do not qualify as official warrants and are not legal justification for holding someone who has served his or her sentence or is no longer under arrest — so many cities and the entire state of California have refused to comply with them.

The federal government is suing California over several sanctuary laws passed last year, including one that restricts law enforcement cooperation with immigration officials.

Protection from liability isn’t likely to make jurisdictions suddenly follow the detainer requests, Peters said.

“Politically, that concern doesn’t seem to be a major reason why states may or may not be willing to comply,” she said. “It seems to be much more ideological about whether they should be complying with ICE or not.”

sarah.wire@latimes.com

Twitter: @sarahdwire