The House on Wednesday soundly rejected a wide-ranging Republican immigration bill that would have funded President Trump’s border wall, offered young undocumented immigrants a path to citizenship and partially addressed the family-separation crisis at the southwest border.

The bill failed on a vote of 301-121 despite a last-minute tweet of support from Trump – in all caps – the backing of Republican leadership and weeks of negotiations between conservatives and moderate Republicans who sought an elusive intraparty compromise.

But the Republican Party has been unable to bridge the divide between hard-liners aligned with Trump and moderates intent on addressing the fate of undocumented immigrants known as “dreamers.”

Maine’s representatives split their votes, with Rep. Chellie Pingree, D-1st District, voting against, and Rep. Bruce Poliquin, R-2nd District, voting in favor.

Highlighting the Republicans’ persistent failure to achieve consensus on any immigration-related legislation, Republican aides also said that the House would not vote this week on a narrower measure aimed squarely at the separation policy amid disputes between Congress and the White House on how far such a bill should go.

Lawmakers will leave for a 10-day Fourth of July recess taking no action amid an uproar over the separation policy and the haunting images of migrant children housed in metal cages.

Lawmakers spurned an 11th-hour tweet from Trump, who urged lawmakers in capital letters to “SHOW THAT WE WANT STRONG BORDERS & SECURITY” by passing the bill.

During debate on the floor, Rep. Bob Goodlatte, R-Virginia, read Trump’s tweet, seizing on his closing exhortation to “WIN!”

“That’s what we need to do today,” Goodlatte said. “We need to win.”

But that failed to sway Republicans like Rep. Warren Davidson, of Ohio. A member of the hard-right Freedom Caucus, Davidson has questioned several aspects of the bill despite the painstaking negotiations, including a lack of provisions aimed at “sanctuary cities” that do not cooperate with federal law enforcement. Several Republicans also see any bill with a path to citizenship as “amnesty.”

Trump’s Wednesday tweet stood in stark contrast to one he sent Friday in which he said Republicans “should stop wasting their time on Immigration” until after the midterm elections, when, he predicted, more Republican lawmakers would be elected.

Republican leaders have struggled to rally support for the bill, postponing a vote twice in the face of internal opposition and uncertain support from Trump. No Democrat supported the bill, which not only funded the border wall but also rolled back legal immigration pathways favored by most Democrats.

“I’m going to need the president’s call,” said Rep. Dave Brat, R-Virginia.

Republican lawmakers spent more than month embroiled in an extended debate about a divisive issue that House leaders had hoped to avoid in an election year. Court decisions have held up Trump’s cancellation of the Deferred Action for Childhood Arrivals program, which has protected hundreds of thousands of undocumented dreamers from deportation. Those court rulings also sapped any urgency in Congress to act.

But a cadre of Republican moderates, frustrated by the inaction, moved in May to force votes on bills, including bipartisan measures favored by most Democrats. Republican leaders scrambled to avoid the possibility of a Republican-led House passing a relatively liberal immigration bill by convening negotiations on a Republican-written alternative.

The resulting legislation largely follows immigration principles issued by the White House in January, providing $25 billion for Trump’s long-sought border wall, scaling back legal immigration and giving young undocumented immigrants in the country a shot at citizenship. It also would allow migrant families to remain together in detention.

Before Wednesday’s tweet, many Republicans had complained that Trump had not been emphatic enough in his support for the bill. The House rejected a more conservative immigration bill last week, after Trump visited Capitol Hill in a bid to get at least one of the two bills through the chamber. But lawmakers felt that Trump has not explicitly called on them to pass the compromise measure, leaving them free to vote only for the more conservative alternative.

Still, House lawmakers negotiated through the weekend trying to figure out whether they could add components to the bill that would get it closer to passage.

Republican leaders filed a 116-page amendment Monday night that would expand temporary visas for agricultural workers while also requiring all employers to screen their workers for legal status using the federal “E-Verify” database.

But conservatives continued to balk at other aspects of the bill, including its central appeal to moderates: a clear pathway to citizenship for the roughly 1.8 million young undocumented immigrants who arrived in the United States as children.

To many conservatives who weighed in on the bill Tuesday, that represents an amnesty that they say would only serve to encourage future illegal immigration. But that position has infuriated moderates, who spent weeks at the negotiating table, handing concessions to conservatives to secure their support.

On Tuesday evening, House leaders decided to abandon their latest amendment and go forward Wednesday with a vote on a bill that they expected to fail. Two Republican aides contacted Wednesday morning said Trump’s tweet was unlikely to change the outcome.

“Too little, too late,” said one, speaking on the condition of anonymity to be candid.

Another said Trump’s tweet “certainly would have been more helpful literally any other day but today.”

Republican leaders stopped well short of predicting its passage before Wednesday’s vote. Speaking on Fox News Channel shortly before Trump’s tweet, House Majority Whip Steve Scalise, R-Louisiana, said there was “still a divide” in the Republican ranks over immigration.

“You could see it in the vote last week, and this week there’s probably a little bit more of a divide,” he said on “Fox & Friends” before blaming Democrats for the impasse: “What the Democrats want is amnesty and open borders and that’s really what it’s come down to, and they don’t want to build the wall.”

Democrats have at times expressed a willingness to negotiate border security funding – and in some cases, border wall funding – in exchange for protections for dreamers, but they have generally rejected Trump’s calls for scaling back legal immigration. More recently, the Trump administration’s “zero tolerance” policy on border enforcement, resulting in the family separations, have prompted Democrats to become more aggressive in their opposition.

White House Legislative Director Marc Short said in a separate Fox News interview Wednesday that it was “important for us to show what we stand for” regardless of the vote’s outcome.

“This vote in the House today will basically show that to the American people: Here’s the principles to secure our border,” he said. “It also deals with the DACA population in a very humane way.”