WASHINGTON — A feisty debate Tuesday night laid bare some rifts among the Republican presidential candidates on foreign policy and national security.

Former Georgia Rep. and House Speaker and newly crowned front-runner Newt Gingrich — who shares the lead of the polling pack with former Massachusetts Gov. Mitt Romney — was repeatedly pitted against libertarian Texas Rep. Ron Paul. Gingrich, who appeared at home in an event sponsored by a pair of conservative think tanks, sought in a typical answer to “make a deeper point.”

During a long back-and-forth on illegal immigration, Gingrich took criticism from multiple sides.

Gingrich said a limited amnesty law he supported in the 1980s did not succeed in securing the border and establishing an effective guest worker system. He advocated a panel modeled on a military draft board to review the cases of an estimated 10 million-plus illegal immigrants, with a path to citizenship for those who have been in the U.S. for years and built ties in their communities, but recent arrivals sent back.

“I’m willing to take the heat in saying we need to be humane in enforcing the law,” Gingrich said.

He did.

“I think the Speaker just said that he would make 11 million people who are here illegally now legal,” said Minnesota U.S. Rep. Michele Bachmann. Gingrich disputed her characterization, saying his program would only apply to a portion of the illegal population.

“Amnesty is a magnet,” Romney said.

Texas Gov. Rick Perry said any immigration policy must start with securing the border.

Gingrich and Paul sparred early on the Patriot Act, the  post-9/11 law authorizing more domestic surveillance and tracking of terror suspects. Paul called the law “unpatriotic” and said the intellectual argument in favor of it was akin to putting a policeman and a camera in every home to stop domestic violence.

To emphasize his point, Paul said Oklahoma City bomber Timothy McVeigh was successfully prosecuted in civilian court.

“Timothy McVeigh was successful,” Gingrich shot back. “I want a law that says: ‘You try to take out an American city, we’re going to stop you.’ ”

Romney, a few minutes later, declared Gingrich correct and the crime comparison invalid. “There’s a different body of law that relates to war,” Romney said.

Riding the strength of his debate performances and the stumbles of previous favorites, Gingrich has emerged in recent weeks as the top challenger to Romney for the polling lead. A national CNN poll released Monday showed Gingrich in the lead with 24 percent support, followed by Romney at 20 percent and  businessman Herman Cain at 17 percent.

Cain used to be the polling leader but his support has tumbled a bit in recent weeks amid accusations of sexual harassment from former employees and flubs on foreign policy questions. A recent interview in which he did not appear to know much about President Barack Obama’s policy in Libya — in which U.S.-NATO airstrikes helped oust dictator Moammar Gadhafi — went viral on the Internet.

Cain had no such embarrassing moments Tuesday. He sparred with Paul on whether to join with Israel in a hypothetical bombing of Iran’s nuclear sites.

Cain said he would, as long as Israel had “a credible plan” that he felt would succeed. Paul scoffed, saying “They can take care of themselves.”

Cain clarified that such a scenario would be “highly unlikely” because the terrain in Iran is mountainous and there would be so many potential targets.

Gingrich, for his part, said the key to containing the hostile theocracy is “cutting off the gasoline supply to Iran and sabotaging the only reactor they have.” He would bomb Iran “only as a last recourse and only as a step to replacing the regime.”

The candidates also differed on the war in Afghanistan, a debate that pitted Romney against former Utah Gov. and Obama administration ambassador to China Jon Huntsman.

Huntsman advocated immediate troop reduction to between 10,000 and 15,000 to continue surveillance and special operations aimed at disrupting al-Qaida.

Romney replied that commanders in the field are saying a drawdown before 2014 would be dangerous.

“I also remember when people listened to the generals in 1967 and we heard a certain course of action in South Asia that didn’t serve our interests very well,” Huntsman replied, referring to the Vietnam War.

On airport security, Cain would not go as far as former Pennsylvania Sen. Rick Santorum and explicitly say that Muslims should be more likely targets of extra screening. But he did call for a “targeted identification” program to profile potential terrorists.

“If you take a look at the people who are trying to kill us, it would be easy to figure out exactly what that identification profile looks like,” Cain said.

During a follow-up, he mistakenly called CNN moderator Wolf Blitzer “Blitz,” which caused a few chuckles and Cain noted: “This is a blitz debate.”