Newt Gingrich has gambled his status as the latest frontrunner in the Republican presidential race by advocating a "humane" approach to illegal immigration, a stance that risks alienating conservatives.

Gingrich, the former House Speaker, said he was conscious he was entering an area that was potentially dangerous for him. "I am prepared to take the heat for saying let's be humane in enforcing the law," he said on Tuesday night.

An earlier frontrunner in the race, Texas governor Rick Perry, saw a sharp drop in his support in September after advocating a similar approach to immigration.

Gingrich was speaking during a Republican presidential debate in Washington in the runup to the nomination contests, which begin in Iowa on 3 January. The debate on foreign policy and security was dominated not only by immigration but Iran, Pakistan and the Patriot Act.

Gingrich is the newest candidate to achieve frontrunner status in the polls. Others - Michele Bachmann, Perry and Herman Cain - have enjoyed being out in front, billed as rivals to former Massachusetts governor Mitt Romney.

The former Speaker has emerged in the lead through his performances in the debates, demonstrating a knowledge of issues absent from some other candidates.

He is given to speaking his mind, sometimes in a temper or in an ill-judged moment. But he was well aware during the debate of the consequences of backing a policy unpopular with Republicans.

He argued the children of illegal immigrants should not be ripped away from their families. He said that he did not believe Americans wanted to take people who have lived in the country for 25 years and expel them over a crime committed long ago.

It is a sensitive issue for Republicans, many of whom want to expel illegal immigrants, even though they are critical to the economy and many have lived almost their entire lives in the country.

Spin-doctors for his rivals, including Romney, Michele Bachmann and Rick Santorum, jumped on Gingrich's comment, viewing it as a mistake. A spokesman for Romney pointed out that Gingrich had supported 'amnesty' legislation for illegal immigrants in 1986 and "was repeating the mistake now".

But Gingrich was unrepentant, his team saying that it was unrealistic to expel an estimated 12 million people.

Conservatives might admire him for his bravery in standing up for a policy that could cost him votes. Although his stance is the same as Perry's, the problem for Perry was that he went on to describe as heartless Republicans who did not agree with him. Gingrich was more subtle, saying that the Republicans were the party of the family and should not be the party that breaks them apart.

Romney, the candidate that is still likeliest to win the party nomination to take on Barack Obama for the White House next November, had a relatively subdued night.

On Iran, Gingrich was as measured as he was on illegal immigration, at least compared with other candidates. While some leaned towards supporting an Israeli strike against Iran's nuclear facilities, Gingrich expressed scepticism because an attack would still leave the regime in place. He advocated instead covert actions, taking out Iran's scientists and undermining the regime. One of the benefits of such an approach, he said, was that it was deniable.

Perry, who made headlines in the last debate with a memory lapse when listing one of his key policies, got through the night without making any further gaffes.

Cain, following a bad week in which he was caught on video demonstrably ignorant about US policy on Libya, did little in the debate to give voters confidence he had a handle on foreign issues. He backed the idea of an attack on Iran but added the caveat that it would have to be done with care because it was "a mountainous region" and there were about 40 sites where nuclear facilities could be hidden.

Romney said he would be willing to take military action but favoured firstly imposing crippling sanctions.

The candidates were harsh in denouncing Pakistan, particularly Bachmann, who expressed concern that its nuclear facilities were vulnerable to terrorists. Perry proposed withdrawing US aid to the country.

Paul, a libertarian and maverick, had a feisty debate, critical of the US response to terrorism. "I think the Patriot Act is unpatriotic because it undermines our liberty… I have a personal belief that you never have to give up liberty for security. You can still provide security without sacrificing our Bill of Rights."

The GOP presidential race is finally coming into the home straight as the Republican candidates gather for tonight's debate – with just 42 days and only three more debates to go before a real election takes place in Iowa