AMHERST, N.H. — The Republican presidential contenders are tying themselves in knots over immigration.

Newt Gingrich is endorsing a South Carolina law that allows police to demand a person's immigration status — a week after taking heat for advocating a "humane" approach. Rick Perry, though defending Texas' in-state tuition for some illegal immigrants' kids, spent Tuesday campaigning with a hardline Arizona sheriff in New Hampshire. And Mitt Romney is talking tough on immigration in his second White House campaign, though he previously supported the idea of allowing some illegal immigrants to stay in the U.S.

Meanwhile, many voters say immigration won't determine which candidate they'll back for the GOP nomination. Instead, they say they're focused squarely on the economy and jobs.

"In light of the economy, questions about immigration policy are less egregious," said Loras Schulte, an evangelical conservative from northeast Iowa.

So what gives?

The contortions by the Republican candidates illustrate the straddle they're attempting on a complex issue. In order to win the Republican nomination, they must court a GOP electorate that is largely against anything that could be called "amnesty" for illegal immigrants. But they can't come off as anti-immigrant, a stance that could alienate the independents and moderates — not to mention Hispanics — they'd need to attract in a general election should they win the party's nod to challenge President Barack Obama.

In 2008, immigration helped shape the Republican presidential race, with John McCain bypassing the leadoff caucus state of Iowa — and planting his flag in New Hampshire — after seeing his standing tank when he backed a plan to give some illegal immigrants an eventual path to citizenship. Still, former Arkansas Gov. Mike Huckabee won the caucuses that year despite having backed tuition benefits in his state for children of illegal immigrants. And McCain ended up winning the nomination despite his position.

Exit polls in Iowa that year found Republican caucusgoers naming immigration their top concern.

This year, many Republican voters are focused on an unemployment rate that's been stuck around 9 percent nationally and is even higher in some states. A poll by The Des Moines Register taken last month showed economic and fiscal concerns topping immigration.

"Four years ago it was about who is the best person in the party. And now they are saying, 'Who can beat Obama?'" said Susan Geddes, a top organizer in Iowa for Huckabee last time.

But immigration as an important issue has hardly gone away. Gingrich is the latest to wrestle with it.

Enjoying a rise in national and state polls, he called in a debate last week for an approach that would grant legal status to illegal immigrants with longstanding family and community ties. Since then, he has been defending that approach from attacks by opponents who say it would amount to amnesty for millions.

"An absolute falsehood," Gingrich retorted Tuesday while campaigning in Bluffton, S.C. He pressed his rivals to say how they would deal with some 12 million illegal immigrants in the country.

"What is it that you're going to do? Are you really going to go in and advocate ripping people out of their families?" he said.

A day earlier, however, he sounded like an immigration hardliner when he expressed support for a South Carolina law that would require law officers who make traffic stops to call federal officials if they suspect that someone is in the country illegally.

At the College of Charleston, he called the law "pretty reasonable."

In New Hampshire, Perry looked to regain his footing on the issue that his dogged his campaign from the outset.

With Arizona Sheriff Joe Arpaio at his side, the Texas governor, who opposes a border fence with Mexico, defended anew his signing of legislation to allow in-state tuition for children of illegal immigrants.

"They are working toward getting citizenship, and they pay full in-state tuition," Perry said. "As the sheriff knows, I've been fighting this illegal immigration issue for a decade. But the people of Texas made that decision."

Arpaio, the Maricopa County sheriff known for his forceful immigration enforcement, endorsed Perry in New Hampshire, praising his experience as a border governor. But he wouldn't comment on Perry's in-state tuition position.

Perry got an earful on that from Alice Bury, a retired nurse. She told him she was "really having a problem" with his tuition policy and described it as a likely deal breaker.

Romney, meanwhile, was in Florida rolling out the endorsements of prominent Cuban-American lawmakers, including Florida Reps. Ileana Ros-Lehtinen and Mario Diaz-Balart and former Rep. Lincoln Diaz-Balart. They endorsed him despite misgivings about where he stands on immigration.

"I don't agree with Gov. Romney's position on immigration, but I agree with him solidly on the economy and for me, that's the driving force in this election," Ros-Lehtinen said.

Immigration is among the several areas where the former Massachusetts governor has shifted his positions.

In the months before he formally became a 2008 presidential candidate, Romney supported the idea of allowing some illegal immigrants to remain in the country, saying: "People who had come here illegally and are in this country, the 12 million or so that are here illegally, should be able to sign up for permanent residency or citizenship. But they should not be given a special pathway, a special guarantee, that all of them get to stay here for the rest of their lives."

In recent days, he's assailed Gingrich's position, characterizing it as "a new doorway to amnesty."

"It's a mistake as a Republican Party in trying to describe which people who've come here illegally should be given amnesty, to be able to jump ahead of the line and the people who have been waiting in line," Romney told reporters in Des Moines last week.

And yet, all that shifting by all those candidates may not matter to the bulk of conservative Republican voters in Iowa, New Hampshire and South Carolina, when the three states kick off the state-by-state march to the GOP nomination.

In interviews, several Republicans said that while the GOP nominee must be tough on sealing the border, they'll choose the Republican who can best fix the economy, create jobs and beat Obama — and that may be good news for Gingrich in particular, given that he's taking the most heat on the issue lately. Few said Gingrich's position was a disqualifier.

"Immigration matters to me, but I didn't get as offended by Gingrich," said Doug Illsley, a college student from Merrimack, N.H.

While immigration remains a GOP priority, its intensity has waned, said Chip Saltsman, Huckabee's national 2008 campaign manager. "The intensity this year is dominated by jobs and spending."


Peoples reported from Amherst, N.H. Philip Elliott contributed from Bluffton, S.C., and Kasie Hunt contributed from Miami.