Editor's Note: This originally appeared in The Hill.

The Republican approach to immigration is shifting as the 2018 midterm elections loom.

The earthquake began when candidates backed by President Trump played strong anti-immigrant cards in Virginia’s gubernatorial race and Alabama’s Senate race — and both came up losers.

Trump, who had begun pulling down the curtain on the Obama-era program called Deferred Action for Childhood Arrivals (DACA), is himself now talking a different game.

The popularity of DACA has been on the rise. The program allows many people who arrived illegally in the U.S. as children to avoid deportation.

Last week, Senate Minority Leader Charles Schumer, D-N.Y., took to the Senate floor and said, “We are in the process of negotiating with Republicans to provide a significant investment in border security in exchange for DACA. These talks continue to progress, and I’m hopeful we can reach an agreement.”

Republican Sen. Jeff Flake , Ariz., told reporters last week that the working group was “very close” to a deal. Flake had previously said that he had a “firm commitment” from Senate leadership to work with him on a permanent DACA fix in exchange for his vote on the GOP tax cut bill.

Earlier this month, 34 House Republicans sent a letter to Speaker Paul Ryan, R-Wis., urging a vote on a DACA fix before the New Year. Many of those Republicans represent swing districts with a growing number of immigrants.

"We are compelled to act immediately because many DACA recipients are about to lose or have already lost their permits in the wake of the program's rescission," the letter read.

Trump, unlike any other Republicans, can do his party colleagues in Congressional a huge favor by resolving the issue before the midterm elections.

House Minority Leader Nancy Pelosi, D-Calif., said flatly, “We will not leave here without a DACA fix.”

Powerful business interests ranging from the U.S. Chamber of Commerce to Facebook CEO Mark Zuckerberg’s immigration reform group have been lobbying Congress hard to pass a DACA fix.

“If ever there was an occasion to come together to help people improve their lives, this is it,” wrote Tim Cook, the left-leaning head of Apple, and Charles Koch, the conservative chief executive of Koch Industries, in a Washington Post op-ed last week.

While Trump has expressed sympathy for the children who were protected by DACA, the urgent question is whether he will have the courage to buck hard-right, anti-immigrant Republicans.

Just last week, Trump won plaudits from right-wing websites and TV commentators for tying immigration to terrorism and calling on Congress to end “chain migration” and “visa lotteries” in the wake of two recent attempted bombings by immigrants in New York City.

Rep. Steve King, R-Iowa, went very low this month when he tweeted “diversity is not our strength,” and quoted a Hungarian autocrat popular with European white nationalists, saying that mixing cultures leads to a “lower” quality of life.

Today’s strong economy and vibrant American culture with 43 million immigrants, more than 13 percent of the population, clearly refutes King’s charge.

King obviously finds political advantage in Iowa by fanning anger at immigrants. Trump had success selling the same bitter brew nationwide in his winning 2016 presidential campaign.

He showed no change of heart when he quickly made political hay over a jury’s decision earlier this month to acquit an undocumented immigrant of killing a young woman in San Francisco in 2015. Trump used the tragedy to rail against “sanctuary cities” and renew his call for a border wall.

“No wonder the people of our country are so angry with Illegal Immigration,” he tweeted.

The facts tell a different story, with U.S. Customs and Border Protection reporting that border apprehensions of people seeking to enter the nation illegally are at the lowest level in 45 years.

Trump earlier called for legal immigration to be cut in half. And he pardoned former Sheriff Joe Arpaio of Maricopa Co., Ariz., who was found guilty of contempt of court for detaining people for no other reason than suspicion of being illegal immigrants.

Trump also endorsed an accused child molester in the Alabama Senate race because, he claimed, the Democrat would be “weak” on immigration and border security.

Trump’s drumbeat of demonization for immigrants gives him unimpeachable credentials among the GOP base.

Along with his March deadline, it creates an opening for him to have a “Nixon to China” moment in which a hardline president turns on a dime to make a surprising political deal.

Trump, unlike any other Republicans, can do his party colleagues in Congressional a huge favor by resolving the issue before the midterm elections. His base may trust him enough not to hold such a move against him.

President Bush couldn’t get this done in 2006 due to opposition from right-wing talk radio hosts who shouted “amnesty.” Republicans on Capitol Hill failed again in 2013 when the far right blocked the push.

Once again, time is running out. Will Trump and the GOP seize the opportunity or have it as another albatross around their neck for the midterms?