Sen. Marco Rubio (Fla.) greets people in Londonderry, N.H., on Sunday. Like several other primary states, the views of Republican voters in New Hampshire are mixed about illegal immigration. (Charles Ommanney/The Washington Post)

The voter at Marco Rubio’s town hall meeting was worried. One of his most trusted employees, Fernando, is an undocumented immigrant. “He hasn’t raped anybody,” the man said. “He hasn’t stolen anything.” What would Rubio do as president to help Fernando stay here?

After assuring voters that he wanted to secure borders, the senator from Florida said that, when it comes to Fernando and other undocumented immigrants who are not criminals, “we’ll figure something out.”

After a year in which hard-line anti-illegal-immigration rhetoric has dominated the Republican campaign, geared largely toward conservative voters who turned out in last week’s Iowa caucuses, the days leading up to the New Hampshire primary have offered reminders that the issue remains complicated for the GOP.

Front-runners Donald Trump and Sen. Ted Cruz (Tex.) have stuck to their position that illegal immigrants should be deported. Both reiterated that view during Saturday night’s debate. Trump alluded to his past statements — in which he described Mexicans coming across the border as “rapists” — as evidence that he had the right personality to be president.

“I hit immigration, I hit it very hard,” he said. “Everybody said, ‘Oh, the temperament,’ because I talked about illegal immigration. Now, everybody’s coming to me, they’re all trying to say, ‘Well, he’s right, we have to come to him.’ ”

Sen. Marco Rubio (R-Fla.) trails Republican presidential candidate Donald Trump significantly but is running ahead of former governor Jeb Bush (Fla.) and Gov. Chris Christie (N.J.). They are pitting their experience against the Florida senator’s record. (Alice Li,Dalton Bennett/The Washington Post)

But New Hampshire is one of many primary states where views on immigration among Republican voters are more mixed. While many conservatives support deporting the estimated 11 million immigrants in the country illegally, other GOP voters are often in line with the business community, which relies on migrant labor, and with party leaders who have pressed for a softer tone to avoid alienating Hispanic voters. The chamber-of-commerce wing of the party is also influential in South Carolina, home to another crucial primary this month, and in later states such as Florida, where state-level Republicans have won elections by carving out middle-of-the-road stances on immigration.

In New Hampshire, for instance, the state’s popular Republican senator, Kelly Ayotte, voted in favor of the bipartisan “Gang of Eight” bill co-authored by Rubio that would have created a path to citizenship.

Eleven percent of voters here said in a CNN-WMUR poll that immigration is their top primary issue, compared with 34 percent who cited foreign policy and national security and 26 percent who said jobs and the economy. There is little suggestion here, as there is in some other states, that illegal immigrants are taking away jobs. There are only 15,000 undocumented immigrants in this state of 1.3 million, according to the Pew Hispanic Center, and the state’s unemployment rate is 3.1 percent.

For some candidates, immigration is the issue that does not roar. Ohio Gov. John Kasich, who has held 100 town halls across the state, said in an interview that no one has asked him an angry question about immigration during all that time, and his view is an unfiery as it gets. “If you haven’t committed a crime, pay a penalty, back taxes, and you can be legalized” although not a citizen, he said.

The contrasting approaches to immigration in this year’s GOP field reflect a years-long struggle over how to approach the issue, and how the party should position itself to win a larger share of the fast-growing Hispanic electorate.

After the party’s loss in the 2012 presidential election, in which nominee Mitt Romney unsuccessfully tried to finesse the issue by saying undocumented immigrants should self-deport, an internal GOP study concluded that it should embrace immigration legislation that provides a pathway to citizenship. That view was shared by Rubio and former Florida governor Jeb Bush, among others.

Rubio and his Senate colleagues drafted the legislation and passed it in their chamber. But conservative activists and House members rebelled, and Rubio, ultimately, abandoned the effort.

The legislation became a flash point in the 2016 race. It provided an opening for Trump to say the party had lost its way, and he rocketed to the top of polls after his comments about illegal immigrants.

Last week’s Iowa results showed that the issue’s effect on the race is muddled.

Rubio’s surprisingly strong third-place finish demonstrated that a softer approach also could be acceptable to many voters in the party. Only 13 percent of caucus-goers said in entrance surveys that immigration was their top issue. For Trump, who finished second, it remained key, as 44 percent of his supporters said immigration was their top issue, compared with 10 percent for Rubio.

The caucus results were also historic in that a majority of participants voted for a Hispanic candidate. Cruz, who won the caucuses, and Rubio are Cuban American.

In New Hampshire, candidate appearances over the past week underscored how the Republican Party is still grappling with the issue of how to attract Hispanic voters while also sounding tough on illegal immigration.

Cruz, campaigning in Windham on Tuesday, said he helped kill the Gang of Eight bill and attacked Trump for saying nothing about it until it was “a good issue.” Then, speaking on Thursday in Weare, Cruz accused Rubio of breaking a promise to oppose “amnesty.”

“Why would Marco have done that?” Cruz said. “It’s not complicated. . . . It’s the corruption of Washington. All the money in Washington supports amnesty. All the big donors support amnesty. It was a very simple play. That’s why Washington is so corrupt.”

Cruz has said he opposes legal status for those who came here illegally and would send back anyone found to have violated the law, but he has not definitively said that he would round up the millions of illegal immigrants and deport them.

Trump, meanwhile, is betting that even if most voters do not see immigration as the top issue, he will get a large percentage of the votes of people who care most about it.

“It is one of the reasons that Trump has gotten so much traction here,” said Andrew Smith, director of the University of New Hampshire Survey Center.

That helps explain why Trump shows no sign of toning down his rhetoric, telling voters in Exeter on Thursday, “the reason I’m leading in the polls is because of immigration.”

State Rep. Carlos Gonzalez, a Republican who became the first Hispanic member of the legislature when he was elected in 2000, said he thought the party was moving in a more moderate direction on immigration before Trump ran for president.

“The damage is done, and it is going to be lingering for a while,” said Gonzalez, a native of the Dominican Republic who is a Bush supporter.

Bush has sounded increasingly confident in taking on Trump over the issue in New Hampshire. He has earned some of his loudest applause when he denounces the mogul’s call to deport the nation’s undocumented immigrants or when he faults the front-runner for disparaging Mexican immigrants.

Bush supports creating ways for eligible undocumented immigrants to earn legal status, conceding that the political will probably does not exist to grant them citizenship, which he once advocated.

Bush tussled with Rubio over the subject during the final presidential debate in Iowa, saying that the senator “cut and run” from the subject after co-sponsoring the 2013 Senate bill. When Rubio accused Bush of changing his stance on the issue, Bush shot back: “So did you, Marco.”

In Saturday’s debate, New Jersey Gov. Chris Christie pointed to Rubio’s handling of the bill as a demonstration of weakness. “A leader must fight for what they believe in. Not handicap it and say, well maybe since I can’t win this one, I’ll run,” Christie said.

Rubio said he accepted that the measure was not popular with many Americans, who he said did not trust the government to fix the system.

“We can’t get that legislation passed,” Rubio said. He added later, “I believe the American people will support a very reasonable, but responsible approach to people that have been here a long time, who are not dangerous criminals, who pay taxes and pay fines for what they did.”

Dan Balz and Philip Rucker in Exeter and Katie Zezima in Weare contributed to this report.