LAS VEGAS — Sharing a stage for the first time, Hillary Rodham Clinton and her Democratic challengers hashed out their differences Tuesday night over guns, foreign policy and Wall Street regulation in a pointed but largely polite debate that underscored the broad consensus among the party’s leading presidential contenders.

Without a Donald Trump hurling insults or very many policy divisions, the five hopefuls spent much of the night addressing parts of their past, votes they have cast or, in Clinton’s case, a perception she has tailored her positions — moving leftward in support of same-sex marriage and opposing a new trade deal with Asia — out of political expediency.

“Actually, I have been very consistent,” Clinton said, in the first of several occasions when she defended her integrity. “Over the course of my entire life, I have always fought for the same values and principles, but, like most human beings ... I do absorb new information. I do look at what’s happening in the world.”

Thrown on the defensive for much of the night, Vermont Sen. Bernie Sanders said his conscientious objector status during the Vietnam War was no disqualification from serving as commander in chief.

“I am not a pacifist,” Sanders said. “I supported the war in Afghanistan. I supported President Clinton’s effort to deal with ethnic cleansing in Kosovo. I support air strikes in Syria. ... I happen to believe from the bottom of my heart that war should be the last resort. ... But, yes, I am prepared to take the country to war if that is necessary.”

Nothing that was said in the roughly two hours on a red, white and blue Las Vegas soundstage appeared likely to shift the fundamental dynamic of the race, which has Clinton running ahead in most polls and the rest of the field elbowing to emerge as a viable alternative.

But it did give each of the candidates an opportunity to shore up their perceived weaknesses, starting with Clinton, who demonstrated a crisp command of issues and flicked away questions about controversies involving her private use of an email server and her 2002 vote authorizing the war with Iraq.

She was by far the most experienced debater on the stage — in 2008 alone Clinton participated in more than 20 such forums — and her self-assurance with the fast-paced, confrontational format showed.

Jumping in to make points and directing a firm tone toward CNN’s Anderson Cooper, the main moderator, she mocked Sanders — a self-proclaimed Democratic socialist — after he extolled the virtues of Denmark’s social safety net.

“I love Denmark,” Clinton said with a sly smile. “We are not Denmark. We are the United States of America.”

She again reiterated her regrets about the private server and, turning to offense, attacked Republicans in Congress for using an investigation of the matter “to drive down my poll numbers,” citing an admission by the House Republican majority leader, California’s Kevin McCarthy.

Sanders then threw her a welcomed life-line.

“Let me say something that may not be great politics,” he said. “But I think the secretary is right, and that is that the American people are sick and tired of hearing about your damn emails.”

Clinton smiled broadly and shook Sanders’ hand.

“Thank you,” she said, as the crowd roared.

Addressing the Iraq issue, she noted it dogged her throughout 2008, with then-challenger Barack Obama serving as a main antagonist. But after the election, she pointed out, Obama so valued her judgment he asked her to become his secretary of state.

“I spent a lot of time with him in the Situation Room going over difficult issues,” she said, implicitly underscoring her extensive political experience.

For the rest of the candidates — save Sanders, who has drawn large crowds from coast to coast — the night was an introduction to a country that knows little, if anything, about them.

Former Maryland Gov. Martin O’Malley repeatedly cited his executive experience, saying it distinguished him from Clinton and Sanders.

“I have learned how to get things done because I am very clear about my principles,” O’Malley said in one of several swipes at Clinton’s alleged malleability.

For the other two on the stage, former Rhode Island Gov. Lincoln Chafee and ex-Virginia Sen. Jim Webb, simply being on camera was a victory.

The candidates largely agree on problems facing the country — income inequality, an economic recovery that has left millions still anxious or underemployed, challenges dealing with Russia, addressing perennial conflicts in the Middle East. Their solutions vary mostly in the details, though they did their best to highlight their differences and, in Clinton’s case, bat down Sanders.

One of the most contentious exchanges involved gun control.

Hailing from a rural state with a long tradition of hunting and few gun laws, Sanders has broken with Democrats on several pieces of legislation. Most notably, he opposed the 1993 Brady bill, owing to its five-day waiting period to buy a firearm, and also voted for a 2005 law giving gun manufacturers and dealers immunity from product liability lawsuits.

He called it “a large and complicated bill,” to which Clinton, a former New York lawmaker, sharply responded, “I was in the Senate at the same time. It wasn’t that complicated to me. It was pretty straightforward.”

Another pointed, if somewhat arcane, discussion involved Wall Street regulation and, specifically, the Glass-Steagall Act.

The Depression-area law circumscribed the nation’s big financial institutions, separating their commercial and investment banking activities. Clinton’s husband, President Bill Clinton, signed 1999 legislation repealing some of its provisions and critics have blamed that deregulatory action, in part, for the 2008 financial crisis that led to the Great Recession.

That point is debated by economists. But reinstatement of Glass-Steagall has become a crusade for some on the political left, who want big banks to again separate their riskier activities from more mundane practices, like taking consumer deposits and making loans.

Sanders and O’Malley both called for breaking up the nation’s big banks and reinstating Glass-Steagall, but Clinton said she would take a more comprehensive approach, imposing limits on computerized trading and stiffer penalties on corporate executives whose companies break the law.

The candidates also differed over marijuana legalization.

Sanders said he supported an upcoming initiative in Nevada to legalize pot for recreational use. “I am seeing in this country too many lives being destroyed for non-violent offenses,” Sanders said.

Clinton said she would vote against it, waiting to see how legalization worked in Colorado and Washington state.

Each of the candidates was given an opportunity, at the start, to address their perceived political weaknesses. Clinton addressed the allegation of flip-flopping. Sanders defended his Democratic socialist philosophy. O’Malley denied targeting blacks with his tough criminal justice policies as Baltimore mayor, saying it made all residents feel safer.

Cooper asked Chafee why Democrats would trust a politician who only a few years ago was a Republican, questioning if he, like Clinton, just followed a politically expedient path. “You’re looking at a block of granite when it comes to the issues,” Chafee replied.

Webb was challenged on his opposition to affirmative action, which is strongly supported by many Democrats. Webb suggested there was a silent majority within the party that believes affirmative action needs an overhaul to benefit those most in need.