Turning up the temperature, Hillary Clinton and Bernie Sanders tangled repeatedly in Sunday’s presidential debate over who’s tougher on gun control and Wall Street and who’s got a better vision for the future of health care in America. It was the last Democratic matchup before voting begins in two weeks, and both sides were eager to rumble as polls showed the race tightening.

Clinton rapped Sanders, the Vermont senator, for voting repeatedly with the National Rifle Association, and then welcomed his weekend reversal of position to support legislation that would deny gun manufacturers legal immunity. She rattled off a list of provisions that she said Sanders had supported in line with the NRA: "He voted against the Brady Bill five times. He voted against what we call the Charleston loophole. He voted to let guns go on Amtrak, guns to go into national parks."

Sanders, in turn, said Clinton’s assertion that he kowtowed to the gun lobby was "very disingenuous" and pointed to his lifetime rating of a D- from the NRA.

On health care, Sanders released his plan for a government-run single-payer plan just hours before the debate, and used his opening statement to call for health care "for every man, woman and child as a right." Clinton, by contrast, urged less sweeping action to build on President Barack Obama’s health care plan by reducing out-of-pocket costs and control spending on prescription drugs.

Clinton suggested Sanders’ approach was dangerous — and pie-in-the-sky unrealistic.

"With all due respect, to start over again with a whole new debate is something that would set us back," Clinton said.

She said that under Obama’s plan, "we finally have a path to universal health care. … I don’t want to see us start over again with a contentious debate." She noted that even with a Democratic Congress, Obama was unable to move to a single-payer system.

Sanders dismissed the idea that he’d endanger hard-won victories on health care, insisting: "No one is tearing this up; we’re going to go forward."

When Clinton suggested Sanders’ health care plan would impose a heavier tax burden on the middle class, Sanders insisted they’d come out ahead with lower costs overall.

"It’s a Republican criticism," he said.

The two tangled over financial policy, too, with Sanders suggesting Clinton won’t be tough enough on Wall Street given the big contributions and speaking fees she’s accepted from the financial sector. Clinton, in turn, faulted Sanders’ past votes to deregulate financial markets and ease up on federal oversight.

Then, she took a step back to put those differences in a different perspective.

"We’re at least having a vigorous debate about reining in Wall Street," she declared. "The Republicans want to give them more power."

Overall, the tone of the debate was considerably more heated than the past three face-offs in the Democratic primary. (backslash)But it also included moments of levity.

At different points, both Clinton and Sanders prefaced their criticism of one another with the phrase "in all due respect."

Sanders took note that he was copying Clinton on that verbiage, drawing a chuckle from his rival amid their pointed exchanges.

Then Sanders finished his thought on health care, telling Clinton "in all due respect, you’re missing the main point."

Clinton, playing to her liberal audience, repeatedly cast herself as the defender of President Barack Obama’s most significant accomplishments, including health care and Wall Street reforms. She argued that the Democratic Party had been working to pass a health overhaul since President Harry Truman and said Sanders’ tear-it-up approach to Obama’s plan would pull the U.S. in "the wrong direction."

She cast Sanders’ criticisms of Obama for being too weak in taking on Wall Street as unfair, and declared, "I’m going to defend President Obama for taking on Wall Street" and getting results.

"The Republicans just voted last week to repeal the Affordable care Act, and thank goodness, President Obama vetoed it and saved Obamacare for the American people," Clinton said.

The debate over gun control — an ongoing area of conflict between Clinton and Sanders — took on special import given the setting: The debate took plan just blocks from the Emanuel African Methodist Episcopal Church where nine parishioners were killed during Bible study last summer. Gun control has emerged as a central theme in the race, with Clinton citing the issue as one of the major differences between the candidates.

On Saturday night, Sanders announced his support for legislation that would reverse a 2005 law he had supported that granted gun manufacturers legal immunity.

His changed position came in a statement after days of criticism from Clinton, who had attempted to use his previous vote to undercut his liberal image.

Clinton immediately cast the latest move as a "flip-flop." Sanders said he backed the 2005 law in part because of provisions that require child safety locks on guns and ban armor-piercing ammunition. He also said he supported immunity then in part to protect small shops in his home state of Vermont.

The third participant in the debate, former Maryland Gov. Martin O’Malley, tried persistently to insert himself into the conversation. He focused on his record as Maryland’s governor and accused both Clinton and Sanders of being inconsistent on gun control.

Both Clinton and Sanders are competing for black voters in South Carolina, which hosts the fourth primary contest.

The debate was sponsored by NBC, YouTube and the Congressional Black Caucus Institute.

(Copyright (c) 2016 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)

Join our Newsletter for the latest news right to your inbox