Monday’s Supreme Court ruling on Arizona’s tough anti-illegal-immigration law stirred a growing debate among Republicans over how to navigate an issue that has energized the conservative base and turned off Hispanic voters.

Some on the right were taken aback to see Chief Justice John G. Roberts Jr., an iconic figure to many conservatives, side with the court’s liberals to reject several key provisions in the law and even declare that as a “general rule, it is not a crime for a removable alien to remain present in the United States.”

The ruling came as Republican presidential candidate Mitt Romney has been struggling to connect with Hispanics after courting conservative primary voters with sharp rhetoric against illegal immigration. A survey published Monday showed him ­favored by just one-fourth of Hispanics.

The quandary for Romney and the GOP is clear from recent polling. The Arizona law is very popular with whites and independent voters, according to data from the Pew Research Center, while many GOP strategists think their party has little chance for success in battlegrounds such as Colorado, Nevada and Virginia if Romney doesn’t win close to 40 percent of Hispanics.

The tension among Republicans over immigration has been a years-long struggle and became a point of contention during the GOP primaries, when Romney sought to win over skeptical conservative voters by attacking leading rivals for their more liberal immigration views.

In recent weeks, President Obama has increased the pressure on Romney, announcing that he would halt deportations of hundreds of thousands of young illegal immigrants — action that Hispanic activists had been urging for a long time.

And some leading Republicans, including former Mississippi governor Haley Barbour, have publicly expressed concern that Romney’s positions allow Democrats to portray the GOP as anti-Hispanic.

Romney took a first step toward trying to repair the damage last week, when he told a conference of Hispanic public officials that he would pursue bipartisan fixes to immigration policy in a “civil” manner. He offered to loosen some restrictions on foreign-worker visas. But he did not back down from his more hard-line immigration views, and on Monday, Roy Beck, president of the anti-illegal-immigration group NumbersUSA, called Romney’s statements a “tremendous victory for our side.”

Now, some said Monday, a mixed ruling from a conservative court might change the conversation.

“I’m hoping this decision, which included Justice Roberts, will send a message to conservatives that we cannot allow a few states that don’t represent the majority of Republicans and a few political leaders to define the conservative narrative on immigration,” said Alfonso Aguilar, a Hispanic Republican who heads the Latino Partnership for Conservative Principles.

Romney appeared to be walking a careful line after the ruling.

He had once called Arizona’s broader approach to immigration enforcement a “model” for the country, pointing to a requirement that businesses check the legal status of workers. And he had vowed to reverse the Obama administration’s challenge to the specific law tweaked Monday by the Supreme Court. But in the wake of the court’s ruling, his support for that measure, known as SB 1070, seemed more muted.

Appearing at a fundraiser in Scottsdale, Ariz. — an apparent coincidence of timing — Romney tried to turn the ruling into a critique of Obama’s handling of immigration.

“Given the failure of the immigration policy in this country, I would have preferred to see the Supreme Court give more latitude to the states, not less,” he said. “And there are states now under this decision that have less authority, less latitude, to enforce immigration laws. And it’s really — it’s become a muddle.”

Monday’s ruling was not a pure victory for the law’s advocates. A key provision — allowing local law enforcement officers to ask suspected illegal immigrants for documentation — was upheld.

Still, for Obama, who has endured criticism from Hispanic leaders for a lack of progress on fixing the immigration system and for an aggressive deportation policy, the ruling bolstered his efforts to present himself as a champion for Hispanic voters. Obama had already won praise for directing his administration to sue Arizona, but now he can take credit for blocking many of the provisions viewed as onerous by immigrant advocates.

On the right, the challenge on immigration is more confusing — and the dispute over the Arizona law has exacerbated the tension.

Even the GOP’s biggest Hispanic star, Sen. Marco Rubio of Florida, has struggled to find the right balance, jousting in Spanish over his past support for the Arizona law with the country’s most important Hispanic newsman in an interview that aired Sunday.

Jorge Ramos, an anchor on Univision, the widely watched Spanish-language network, told the senator that he “took the side of the victimizers who are persecuting Hispanics.” He pressed Rubio on a passage in the senator’s new memoir, “An American Son,” in which he said he would probably have voted for the Arizona law if he were in the state legislature, because of the state’s location on the Mexico border.

Rubio, a potential Romney running mate, disputed Ramos’s characterization, saying the Arizona SB 1070 law was not the right approach for his state or many others.

“I do not believe that the Arizona law is a model,” he said. “I don’t want it in Florida, nor do I believe it is necessary in other states.”

Several GOP strategists said Monday that they doubted the Arizona ruling would affect Romney’s performance with Hispanic voters. But they said Romney was wise to point out — as he did again in his remarks Monday after the ruling — that Obama had pledged as a candidate to make overhauling immigration a priority in his first year but did not get it done.

Even if Romney does not dramatically change his positions, they said, he can improve his standing with some Hispanic voters simply by toning down his rhetoric and casting himself as an earnest bipartisan broker.

Whit Ayers, a Republican pollster who has studied the Hispanic vote, said Romney is not likely to match the “peak performance” of President George W. Bush, who espoused relatively liberal immigration views and in 2004 won about 40 percent of the Hispanic vote.

But, Ayers said, Romney has room to grow.

“It makes a big difference when you’re at 25 percent or 35 percent, especially in Nevada, Colorado and New Mexico,” Ayers said.

Staff writer Philip Rucker in Scottsdale, Ariz., contributed to this report.