CNN  — 

The House is expected to vote Thursday on the most robust piece of immigration legislation to come to the House floor in more than a decade, a dramatic showdown that will test some conservatives’ loyalty to President Donald Trump.

After years of almost-votes, countless working groups and false alarms, the significance isn’t lost on Republicans. House members will vote on a bill that funds Trump’s signature campaign promise of a border wall and provides a path to citizenship for individuals who were brought to the US illegally as children by their parents, all happening under a retiring speaker who once vowed to conservatives he would not touch immigration as long as Barack Obama was President.

Whether the bill passes will be up to some of Trump’s closest conservative allies in Congress, a direct reflection of whether members believe they can trust him to spend his own political capital and shield them from any backlash they may face from the base.

“Some of the members want to make sure the President is very visible in his support for both bills this week,” said Rep. Mark Walker of North Carolina, the chairman of the conservative Republican Study Committee. “They want to see it constantly as we move forward.”

Immigration as an issue – unlike tax revisions, gun laws or efforts to reduce the debt – has long divided Republicans more than it has united them, a side effect of regional, cultural and political differences that aren’t easily remedied and have grown only more stark over time.

On Thursday, House Republicans will vote on two immigration bills. One, a more conservative proposal, is openly expected to fail. The other, the Republican compromise bill, isn’t looking much better.

“I’ve come really close a number of times and it’s blown up at the end, so I’m not celebrating until the vote takes place and until it passes, and if it passes, until it becomes law,” said Rep. Mario Diaz-Balart, a Republican from Florida who has been part of countless immigration negotiations in the House.

In the hours leading up to the vote, members and aides were under no illusions the bill was on a fast track to law despite a last-minute lobbying blitz from the Trump administration that included visits from Attorney General Jeff Sessions and Homeland Security Secretary Kirstjen Nielsen as well as an impromptu bus trip to the White House, where Trump sought to personally convert members who were still undecided.

“I haven’t seen evidence that the momentum is there to pass it,” one senior Republican aide told CNN.

Members were sober about the realities. The bill, aides admitted, could fail. Even if it passed, it faced little future in the Senate, where Majority Leader Mitch McConnell, a Kentucky Republican, would need 60 votes and Democratic support to pass it. And a last-minute reversal by Trump to issue an executive order intended to halt family separations along the border took some pressure off members of Congress to act immediately to stop the heartbreaking stories of parents and children being divided.

Closing a chapter in immigration fight

Aides noted that a failed, negotiated Republican immigration bill was better than the alternative.

After all, the entire exercise had been born out of a rebellion by House moderates who in May sought to use a rarely deployed procedural move, a discharge petition, that would have bypassed leadership and forced a vote on four different immigration bills. That was a nonstarter for leaders, who took every opportunity they could to remind members that an uncontrolled immigration debate just months ahead of a midterm election would be an unmitigated disaster and a futile exercise.

To stop the petition, leaders worked with conservatives and moderates on a Republican compromise bill that under other circumstances might never have been drafted, not to mention seen the light of day.

“Everyone wants (to know) will it pass, will it pass, will it pass? That’s not the goal here,” the aide said. “The goal was to stop the discharge petition.”

But the long-simmering distrust among Republican moderates, leadership and conservatives on immigration is years in the making and has been quick to fester.

In a test of loyalty, some of Trump’s closest allies were still blasting the immigration bill – the same one the President said he supported– ahead of the vote.

Republican divisions boil over

Conservative House Freedom Caucus Chairman Mark Meadows, one of Trump’s earliest endorsers and a close confidant, told reporters that ” the compromise bill is not ready for prime time. I’ll leave it at that.”

On the floor of the House Wednesday evening, the North Carolina Republican unloaded on Speaker Paul Ryan so that it was visible to reporters watching in the gallery. The disagreement was over which version of a conservative immigration bill had made it to the House Rules Committee. An angry Meadows laced into Ryan, saying several times, “I’m done,” and even saying he’d be willing “to sign the dang discharge petition.” (Meadows later clarified to reporters that he would not sign the petition.)

He was hardly the only Republican testing his bond with the President.

Lou Barletta, a Republican from Pennsylvania, was also among them. Running for the Senate, Barletta was one of the first members of the House to endorse Trump and he was at the meeting of undecided lawmakers Wednesday at the White House. He told Trump directly that he could not back the bill.

Barletta told reporters he explained to the President that he had made a national reputation as the hardline immigration mayor of Hazleton, and he viewed the compromise bill as too much amnesty.

“He understood,” Barletta said of the President. “He understood.”

The bill has also earned some criticism from moderates.

“This is not a softy bill,” said Rep. Ryan Costello, a moderate from Pennsylvania who will ultimately support the bill.

Rep. Leonard Lance, a moderate from New Jersey, told CNN he was still undecided.

The vote Thursday – and the rarity of discussing such a broad immigration package on the House floor – reflected how much the GOP has changed over the last few decades on immigration. Once the party of compassionate conservatism under President George W. Bush and a party that supported a massive immigration bill under President Ronald Reagan, members admit immigration has grown more and more contentious and less and less a topic they want to debate openly on the floor.

“It wasn’t as politicized an issue then,” said Rep. Joe Barton, a Republican from Texas who voted against the 1986 immigration bill in the House. “I hate to use the world simple, but I will say it was less complex.”

CNN’s Phil Mattingly and Ashley Killough contributed to this report.