LAS VEGAS - (AP) -- Hillary Rodham Clinton and Sen. Bernie Sanders clashed over U.S. involvement in the Middle East, gun control and economic policy in the first Democratic presidential debate Tuesday night, vigorously outlining competing visions for a party seeking to keep the White House for a third straight term.

Yet in a moment of political unity -- and levity -- Sanders leapt to Clinton's defense on the issue of her controversial email practices as secretary of state.

"The American people are sick and tired of hearing about your damn emails," Sanders exclaimed as the crowd in Las Vegas roared with applause. A smiling Clinton reached over to shake his hand and said, "Thank you."

While the five candidates onstage took issue with each other, they also repeatedly sounded traditional Democratic themes -- such as fighting income inequality -- that are sure to carry over to the general election campaign against the Republicans. They also sought to cast the GOP as a party focused on sowing division and denigrating minorities and women.

Before they face the Republicans, the Democrats must choose their own candidate. And throughout most of the two-hour debate Clinton played the role of aggressor, an unexpected shift for a candidate who had barely mentioned her Democratic rivals since launching her campaign six months ago. Until Tuesday night, Clinton and Sanders -- who has surprisingly emerged as her toughest competition -- had circled each other cautiously and avoided direct attacks.

After Sanders, a self-described democratic socialist, derided "a casino capitalist process by which so few have so much," Clinton said it would be a "big mistake" for the U.S. to turn its back on the system that built the American middle class. Asked whether she thought Sanders, who has a mixed record on gun control legislation, had been tough enough on the issue, she said simply," No, I do not."

Sanders is drawing big crowds on the campaign trail and challenging Clinton's fundraising prowess, but he's largely unknown to many Americans. The debate offered him a high-profile opportunity to cast himself as an electable alternative to Clinton and appeal for support beyond his liberal base.

Sanders has sought in particular to distinguish himself from Clinton over foreign policy, an issue where she is often more hawkish than others in the Democratic Party. The former secretary of state reiterated her call for more robust U.S. action to stop the Syrian civil war and defended her judgment on international issues, despite having voted for the 2002 invasion of Iraq.

Sanders called the Iraq war "the worst foreign policy blunder in the history of our country" and said he would not support sending American combat troops back to the Middle East to fight terrorism.

"Nobody does, Senator Sanders," Clinton interjected.

The only woman on stage, Clinton also highlighted the prospect of becoming the nation's first female president multiple times. When asked how her administration would differ from President Barack Obama's, she said with a smile, "Being the first woman president would be quite a change."

Clinton's confident performance was likely to ease anxiety among supporters who have questioned her campaign's handling of the email controversy. One question still to be answered: how her showing will affect Vice President Joe Biden's decision about making a late entry into the Democratic race.

Biden has been deliberating about his political future for months and is expected to announce a decision within days. Debate host CNN kept an extra podium on standby in case he decided to show up, but the vice president instead stayed in Washington, where he was watching the debate at his residence. He was not mentioned during the two-hour debate.

Even with the swirling Biden speculation and Clinton's email controversy, the Democratic contest has largely been overshadowed by the Republican primary, where more than a dozen candidates are fighting to overtake billionaire Donald Trump. The real estate mogul still made his presence known Tuesday night, sending a torrent of Twitter commentary on the Democrats' performances.

"Sorry, there is no STAR on the stage tonight!" he wrote.

While the Republican primary has been roiled by the emotional debate over immigration, the Democratic candidates were largely united in their call for providing a path to legal status for the millions of people currently in the U.S. illegally. The party is counting on general election support from Hispanics, a group that overwhelmingly voted for Obama in 2012

Joining Clinton and Sanders on stage in Las Vegas was a trio of low-polling candidates looking for a breakthrough moment: former Maryland Gov. Martin O'Malley; Jim Webb, a former Navy secretary and U.S. senator from Virginia, and Lincoln Chafee, the Republican-turned independent-turned Democrat from Rhode Island.

For Clinton, the debate was a much-needed opportunity to focus on policy in addition to the controversy over her exclusive use of personal email and a private Internet server during her tenure in the Obama administration. The email issue has shadowed her rollout of numerous policy positions and has hurt her standing with voters.

Clinton said her email use "wasn't the best choice" and cast the issue as a politically motivated effort by Republicans to drive down her poll numbers. She highlighted comments from Rep. Kevin McCarthy, R-Calif., who bragged about how a House committee investigating Clinton's role in the 2012 attacks in Benghazi, Libya, had hurt her politically.

"I am still standing," she said.

The only candidate on stage who challenged Clinton on her email practices was Chafee, who said "credibility is an issue."

The former secretary of state has also faced criticism that she's shifted her positions on trade, gay marriage and other issues to match the mood of voters -- a charge she denied Tuesday.

"Like most human beings, I do absorb new information, I do look at what's happening in the world," Clinton said. Pressed specifically on her newly announced opposition to a Pacific Rim trade deal she touted while serving in the Obama administration, Clinton said she had hoped to support it but ultimately decided it did not meet her standards.