Mitt Romney walked a fine line on immigration at Monday night’s GOP debate, stressing that he is in favor of legal immigration while blasting illegal immigration in South Carolina.

After Fox News’s Juan Williams asked him whether his hard-line immigration stance could hurt him with Latino voters in the general election, Romney avoided taking the strident tone he had in previous debates when he demanded that the U.S. “turn off the magnets” of allowing immigrants here illegally to get in-state tuition, as Rick Perry has backed.

“With regards to immigration policy I absolutely believe that those who come here illegally should not be given favoritism,” he said before stressing that he wants “people to know I love legal immigration.”

Romney has taken a harder line on immigration than any of the other GOP candidates still in the race, which could help him with the very conservative South Carolina GOP populace.

Three of his surrogates at the GOP debate are immigration hard-liners who have stirred controversy on the issue: Bay Buchanan, a top advisor to former Rep. Tom Tancredo (R-Colo.), Rep. Jason Chaffetz (R-Utah) who called for “tent cities” surrounded by barbed wire for illegal immigrants who break the law, and Kansas Secretary of State Kris Kobach (R), who helped Arizona legislators craft that state’s controversial immigration law.

But as Williams pointed out, those stances could hurt him in the general election, a risk he seemed to recognize and seek to ameliorate with his careful answer.