MESA, Ariz. — Earmarks, birth control and an 8-year-old Senate race endorsement prompted plenty of fireworks between Republican presidential hopefuls Mitt Romney and Rick Santorum at Wednesday night’s debate.

Newt Gingrich, the former Georgia congressman, arms folded and legs crossed under his chair, mostly stayed out of the crossfire.

Asked to describe himself in one word, Gingrich said “cheerful,” an emphasis he has made lately on the campaign trail. Yet Gingrich still had plenty of vitriol for President Barack Obama and the news media, represented a few feet away by CNN moderator John King.

At one point Gingrich even seemed to mouth the words “nice job” to Romney after an answer about contraception policy.

The former Massachusetts governor had said, “We have to have individuals that will stand up for religious conscience,” in attacking the Obama administration’s decision to require religious employers to provide health insurance coverage that includes contraception.

The question was about an issue Gingrich and Santorum have both slammed Romney on recently, as during his tenure in Massachusetts all hospitals were required to provide the “morning after pill” to rape victims.

Romney insisted it was voluntary, and Gingrich delicately pressed the case in response, saying newspapers had reported otherwise. Then he pivoted away from Romney to say the real issue was federal overreach.

Contraception, a hot topic in the news of late, took up a significant chunk of debate time but the crowd booed King for bringing up the issue, via a question submitted by a viewer.

King and Gingrich have sparred before, most notably when King asked Gingrich at the South Carolina debate about claims by his second wife that he wanted an “open marriage,” prompting a thunderous denunciation of the media by Gingrich.

This time, Gingrich said there are legitimate questions about the Obama administration’s stance on conscience exceptions for religious institutions.

But, he said, “I just want to point out you did not once in the 2008 campaign, not once did anybody in the elite media ask why Barack Obama voted to legalize infanticide. OK? So let’s be clear here. If we’re going to have a debate about who the extremist is on these issues ... it is not the Republicans.”

Gingrich was referring to Obama’s opposition to a bill outlawing late-term abortions, known as partial-birth abortions.

The intraparty clashes were reserved primarily for Romney and Santorum, who has risen to the top of national polls after three Feb. 7 victories. Romney’s chief argument against Santorum has been that he is a Washington insider, and a symbol of that is Santorum’s support for congressionally directed spending, known as earmarks.

Santorum said “there were good earmarks and bad earmarks” and it was his job in representing Pennsylvania to seek money for the state.

“Congress has a role to play when it comes to appropriating money, and sometimes the president and the administration doesn’t get it right,” he said.

Santorum said Romney’s attacks on the subject are hypocritical because Romney sought federal money as head of the 2002 Salt Lake City Olympics. Romney replied that he was proud of those Games and noted that Santorum voted for a bill that included a controversial earmark for a bridge in Alaska.

“Our Games were successful,” Romney said. “But while I was fighting to save the Olympics, you were fighting to save the Bridge to Nowhere.”

Romney also pressed Santorum on his support for Pennsylvania Sen. Arlen Specter in a 2004 Republican primary, a race many conservatives still grumble about. Specter, a pro-choice moderate, won narrowly against conservative Rep. Pat Toomey, with the backing of Santorum and President George W. Bush.

Specter later switched to the Democratic Party and proved to be a critical vote for Obama’s health care law. (Toomey won the Senate seat in 2010 after Specter lost in a Democratic primary.) Romney used the endorsement to deflect criticism from Santorum that his Massachusetts health care law was the precursor to “Obamacare.”

After repeating his pledge to repeal the health care law, Romney added: “If we had not had Arlen Specter, we would not have had Obamacare. So don’t look at me, look in the mirror.”

Santorum replied that it was a “stretch” to blame him for Obamacare six years later and said he endorsed Specter because the two had a private agreement that Specter, the Judiciary Committee chairman, would let Bush’s Supreme Court nominees through.

Justices John Roberts and Samuel Alito were confirmed rather easily, but Specter denied claims of any such deal during his 2010 race.

Texas Rep. Ron Paul stepped up the Santorum attacks as well. Asked by King why he was airing an ad calling Santorum a fake, Paul replied: “Because he’s a fake.” Paul noted Santorum’s support for spending bills while he was in Congress that increased the size of government. Paul typically votes against appropriations bills.

“This idea of being fiscally conservative now that we’re running for office and we’re going to repeal something that we did before — it loses credibility, is what our problem is,” Paul said. He later described himself in one word as “consistent.”

Arizona and Michigan vote Feb. 28, and Santorum and Romney are running close in both states. Gingrich is not competing hard in either state, focusing mostly on Southern contests — including Georgia — on March 6 Super Tuesday.

Gingrich spokesman R.C. Hammond said if Romney loses Michigan, where he was born and his father was governor, it will throw the race into further turmoil, and he envisioned a scenario where the race narrows to Gingrich and Santorum as the top contenders.

Until then, it seems, cheerful Gingrich is happy to let Santorum and Romney fight.