The rivalry between Sens. Ted Cruz and Marco Rubio flared Tuesday at the final Republican primary debate of the year, as all the leading GOP candidates battled to show their tough-on-terror credentials.

Donald Trump, as in past debates, sparred sharply with his rivals on stage over his controversial proposals, notably his call to ban Muslims from entering the country. But the changing dynamics in the race appeared to drive frequent clashes between the senators from Texas and Florida – who are now battling to be the Trump alternative in the race as Ben Carson slides in the polls.

With the terror attacks in Paris and San Bernardino, Calif., refocusing the race squarely on security issues, Cruz from the outset tried to sound a tough message against radical Islam.

“We will utterly destroy ISIS,” Cruz vowed, later adding: “ISIS and radical Islamic terrorism will face no more determined foe than I will be.”

But he repeatedly was challenged by Rubio over his Senate positions – including for legislation reining in NSA metadata collection. Rubio accused Cruz of helping take away a “valuable tool” for security officials, while Cruz said: “Marco knows what he’s saying isn’t true.”

Rubio later cited a budget vote by Cruz to say: “You can’t carpet bomb ISIS if you don’t have planes and bombs to attack them with.”

Rubio followed up on his attacks against Cruz Wednesday, calling out Cruz's "tough talk" on Fox and Friends.

"All this tough talk, Ted stood up there said 'I'm going to utterly destroy ISIS.' Anyone can say that, but what are you going to do it with?” Rubio said, accusing the Texas senator of supporting a budget that cuts defense spending and voting against defense authorization bills.

New Jersey Gov. Chris Christie used the arguing to contrast his own executive experience against the senators’ legislative history. He described their jobs as “endless debates about how many angels on the head of a pin from people who have never had to make a consequential decision.”

But Rubio and Cruz returned to the fray later on as they tried to cast each other as soft on illegal immigration. “I led the fight against [Rubio’s] legalization-amnesty bill,” Cruz charged.

Some analysts had expected the tensions Tuesday to flare between Trump and Cruz, as the Texas senator surpasses Trump in Iowa polls and is surging nationally. But Cruz avoided taking on Trump in favor of Rubio – he even jokingly backed Trump’s plan to build a border wall.

“We will build a wall that works, and I’ll get Donald Trump to pay for it,” Cruz said.

Later on, Trump backed off comments where he said Cruz acted in Congress like “a bit of a maniac.” Trump said Tuesday, “He’s just fine, don’t worry about it.”

Instead, Trump took heat mostly from former Florida Gov. Jeb Bush, who slammed Trump’s plan to ban Muslims from entering the United States as “not a serious proposal.” 

“He’s a chaos candidate, and he’d be a chaos president,” Bush said.

Trump fired back that “Jeb doesn’t really believe I’m unhinged” and only went after him because he’s “failed in this campaign.”

The Trump-Bush acrimony simmered throughout the debate, with Bush later telling Trump he can’t “insult your way to the presidency,” and Trump once again reminding Bush that his poll numbers have plummeted while Trump is leading.

Whether Bush’s attacks will help the struggling candidate remains to be seen. Perhaps more consequential is whether Rubio or Cruz can present himself as more capable of taking on the country’s security challenges.

Bush followed up on his criticism of Trump on Fox & Friends Wednesday morning, saying: "I just don't think he's ready from day one to be President of the United States."

“He has made it clear that he gets his foreign policy advice from the shows, he makes it clear hew thinks Hillary Clinton was a great negotiator with Iran, he thinks ISIS wasn’t a threat just two months ago – he’s not a serious candidate,” Bush said.

All the leading candidates, though, focused on the terror threat throughout the CNN-hosted primary debate Tuesday night in Las Vegas – an event held just hours after Los Angeles closed its school system over a terror threat.

Citing that closure, which is now thought to have been prompted by a hoax threat, Christie said children will be going back to school filled with anxiety. And he said the country’s overall security environment has been hurt by President Obama and Hillary Clinton’s policies.

“America has been betrayed,” he said.

Christie cited his experience as a federal prosecutor, and governor, in saying that under a Christie presidency, “America will be safe.”

Carson also dismissed “PC” concerns about some of his own plans for taking on the terror threat.

“We are at war … We need to be on a war footing,” Carson said, while later making an argument against toppling foreign dictators. He compared the situation to being on a plane, where passengers in an emergency are advised to use oxygen masks themselves before helping others.

“We need oxygen right now,” Carson said, adding the government needs to think of the needs of the American people before solving everyone else’s problems.

Trump also sparred at times with other lower-polling candidates.

As before, Kentucky Sen. Rand Paul questioned Trump’s policy proposals, including to restrict the Internet to clamp down on ISIS’ social media use. “Do you believe in the Constitution?” Paul said of Trump supporters. Trump clarified he’s only talking about restricting the Internet in parts of Iraq and Syria.

And when Trump suggested that the money spent toppling Mideast dictators could have been better spent on building America’s roads and bridges, former HP CEO Carly Fiorina compared him to Obama.

“That’s exactly what President Obama has said. I’m amazed to hear that from a Republican presidential candidate,” she said.

Ohio Gov. John Kasich also took issue with suggestions from Cruz and Trump that the priority in Syria is not to remove Bashar Assad.

“We can’t back off of this,” Kasich said. “He must go.”

CNN also hosted a debate Tuesday for the second-tier GOP candidates -- former Arkansas Gov. Mike Huckabee, former Pennsylvania Sen. Rick Santorum, South Carolina Sen. Lindsey Graham and former New York Gov. George Pataki. Graham was particularly critical of Trump’s Muslim ban plan at that debate, accusing him of declaring war on Islam and delivering a “coup” for ISIS.