“The Democrats want to use it as a campaign issue, and I keep saying I hope they do,” Trump said of immigration at a recent rally in Tennessee. (Nicholas Kamm/AFP/Getty Images)

Leading Republican candidates are depicting many undocumented immigrants as criminals and endorsing a proposed wall on the Mexican border, adopting President Trump’s hard-line stance and alarming some who fear the GOP is out of step with a rapidly diversifying nation.

The party’s increasingly aggressive tone on the issue represents a shift from just two years ago, when many Republican leaders criticized then-candidate Trump’s rhetoric as racially charged and predicted he would alienate Hispanic voters.

This year, the Trump-like tenor of the campaign trail is evident in places like Georgia, where a Republican candidate for governor is telling voters he can round up undocumented immigrants and put them in his pickup truck. In Indiana, the party’s Senate nominee shows a grainy mug shot of an undocumented immigrant as he calls for the border wall and a ban on “sanctuary cities.” And in Arizona, a Hispanic Republican running for Congress has defended Trump’s description of some immigrant gang members as “animals.”

“I think his message on border security, immigration and so on has really resonated with folks throughout southern Arizona,” said Lea Marquez Peterson, president of the Tucson Hispanic Chamber of Commerce and a GOP candidate in a House district that stretches to the Mexican border, where illegal crossings remain high. She said Trump’s “animals” remark was not out of bounds.

The apparent popularity of the president’s immigration views among top-tier Republican candidates reflects the extent to which Trump has refashioned the party in his image.

Long gone is the GOP’s post-2012 autopsy, titled the “Growth and Opportunity Project,” which, following the loss to President Barack Obama, called for the party to adopt a more liberal position on immigration and work harder to court Hispanics and other minorities. Those ideas were part of the arguments in 2016 from some of Trump’s rivals, such as Jeb Bush and Sen. Marco Rubio (R-Fla.), but Trump’s triumph and continued popularity with GOP voters have made clear that strong opposition to illegal immigration is key to winning the party base.

Some Republicans are deeply troubled by the direction the party is headed on immigration. They worry it eventually will turn voters away from the GOP for good — particularly in demographically changing areas of the country with fast-growing Hispanic populations.

Nearly two dozen moderate Republicans are trying to force the House to vote on measures giving young undocumented immigrants a pathway to citizenship after Trump last year canceled an Obama-era program to protect many of them from deportation. GOP leaders will try to resolve the standoff when Congress returns this week.

“The party should stand for an immigration system that complements our economy, that is compassionate to the victims of illegal immigration,” said Rep. Carlos Curbelo (R), who represents a South Florida district that Hillary Clinton won by 16 points and is leading the charge to force the votes.

“Generally, public officials should try to avoid rhetoric and language that dehumanizes people,” Curbelo said.

Some Republicans fear a backlash to Trump and the prevailing GOP position in suburban and exurban districts that will decide whether the party keeps its House majority.

“Let’s remember what he was running on, and let’s remember all the discriminatory comments that he made about immigrants when he was running for president,” said one of Curbelo’s Democratic opponents, Debbie Mucarsel-Powell, who maintains the congressman has not done enough to stand up to “Trump’s divisive racial slander against immigrants.”

Texas Rep. Will Hurd, California Reps. David Valadao, Steve Knight and Jeff Denham, and other centrist Republicans are also part of the effort to force votes, which a majority of House Democrats have backed. But most House Republicans remain opposed, meaning the moderates must sway a few more GOP lawmakers to sign on to ensure a vote.

Hurd, whose district includes about 800 miles of the border, received a boost on Friday when the U.S. Chamber of Commerce launched an ad casting him as a defender of young undocumented immigrants.

“The last thing we need to do in the long run is turn Hispanic voting patterns into African American voting patterns given the changing demographics of the country,” said Whit Ayres, a veteran Republican pollster. Black voters are a core part of the Democratic base.

Democrats are facing their own conundrums. Party leaders are confronting a restive liberal base demanding they use every legislative tool to protect young undocumented immigrants and stand firm against Trump’s border wall.

Money for the wall is likely to roil the midterm campaign as it enters its final stretch this fall. Congress will be up against a Sept. 30 deadline to keep the government funded. Already, Trump has warned there will be “no choice” but to close the government if he does not get the funds for a wall he repeatedly says Mexico will finance.

As a candidate, Trump routinely called for building the wall and railed against “sanctuary cities,” municipalities where officials face restrictions from alerting authorities about undocumented immigrants. As president, he has tried to punish local officials who did not comply with the federal government.

Republicans running for office this year have adopted his harsh lexicon.

“Criminal illegal aliens are spreading across the country,” Georgia Lt. Gov. Casey Cagle says in a recent ad, as photos of tattooed Hispanic men flashing gang signs are shown.

His Republican opponent for governor, Secretary of State Brian Kemp, tells viewers he has a big truck — “just in case I need to round up criminal illegals and take them home myself.”

Data from Kantar Media published in USA Today shows that Republicans have aired more than 14,000 campaign ads promoting Trump-style immigration views this year, outpacing ads on taxes that Republicans said would be their top issue.

“Most of our base has pretty much the same opinion about wanting to be tough on people that enter the country illegally,” said Rep. Tom Cole (R-Okla.), a veteran party strategist.

In heavily Democratic California, Republicans have telegraphed plans to fight the election on immigration. The Republican-run Orange County Board of Supervisors voted to join the administration’s challenge to a “sanctuary state” law, and congressional candidates have joined the push.

Across four Orange County-based House districts, Republicans have been preparing an anti-sanctuary-state campaign, making some Democrats nervous. The state holds its primaries Tuesday.

Trump has invited a midterm contrast on immigration with Democrats. “The Democrats want to use it as a campaign issue, and I keep saying I hope they do,” Trump said at a recent rally in Tennessee. He called House Minority Leader Nancy Pelosi (D-Calif.) an “MS-13 lover” as he tried to link her to the threat posed by the Central American and U.S. gang and reprised his disparaging label of gang members.

“What was the name?” Trump asked the crowd.

“Animals!” they boomed back.

Rep. Barbara Comstock (Va.), one of the most vulnerable Republican House members running for reelection in a district Clinton won by 10 points, distributed campaign fliers highlighting her support for a border wall and her work “Cracking down on MS-13.”

“This issue, when framed in terms of violent international gangs like MS-13, and gangs in general, gets the GOP back to the tough on crime/soft on crime framing that Clinton (Bill)-era Democrats were finally able to break,” Republican pollster Chris Wilson said in an email.

For many Republicans, immigration is a matter of national security. “Immigration will be a very big issue, to see to the security of our nation. The laws must start to be enforced, evenly, fairly,” said Wendy Warner, a former chair of the Denver Republican Party.

Rep. Joaquin Castro (Tex.), a member of the Democratic Congressional Campaign Committee leadership, said the recent comments from Trump and like-minded Republicans have been “shamelessly divisive, and it’s the worst kind of racial politics,” but the president “is the north star for Republicans across the country and in Congress.”

Trump’s immigration posture is more than welcome in the battle for the Senate, GOP strategists said. Majority control is mostly being fought in Trump-friendly states, include the 10 he won in 2016 where incumbent Democrats are running for reelection.

One is Indiana, where Republican nominee Mike Braun ran his “sanctuary cities” ad in the primary and endorses a crackdown on “criminal illegal immigrants” on his website. Democrats have been more inclined to keep the focus on “kitchen table” matters. Sen. Joe Donnelly’s website features an issues page that mentions trade and health care, among other things, but not immigration.

David Weigel in Carlsbad, Calif., Donald Frazier in Denver, and Jenna Portnoy and Scott Clement contributed to this report.