Democratic presidential candidate Bernie Sanders did not mince words at the first Democratic debate in Las Vegas, where he talked about Wall Street, NSA surveillance, and climate change. (Victoria M. Walker/The Washington Post)

Delivering his opening remarks at the first Democratic debate here Tuesday night, Bernie Sanders was the only candidate to skip introducing himself and his résumé and jump straight into what he darkly termed “a series of unprecedented crises.”

But through much of the encounter — Sanders’s first opportunity to share his views with a large national audience — the senator from Vermont found himself on the defensive: on his political philosophy, his mixed record on gun control, his reluctance to use force as commander in chief, and his mainstream appeal and electability.

The assault came early, with chief rival Hillary Rodham Clinton moving fast to contrast herself with Sanders, a self-described “democratic socialist” who has overtaken her in some early-state polls but whom she had previously avoided criticizing.

When Clinton was asked whether Sanders was “tough enough” on guns, she responded sharply and without hesitation: “No, not at all.”

The biggest moment for Sanders was not talking about his agenda against the nation’s “billionaire class,” but when he came forcefully to Clinton’s defense.

“The American people are sick and tired of talking about your damn e-mails,” Sanders thundered, drawing loud applause from the live audience at the Wynn Las Vegas resort.

Sanders showed flashes of passion, particularly in assailing what he called the corrupting influence of money in politics or calling for breaking up big banks. But he didn’t talk in detail about his ideas to toughen regulations on Wall Street until more than one hour into the debate — and only after former Maryland governor Martin O’Malley raised the issue, crediting Sanders for his ideas.

Overall, Sanders’s performance was uneven. At the start, he seemed easily bothered. At times on the defensive, Sanders seemed agitated, shouting his positions as if he were rallying thousands of supporters in a sports arena instead of conversing with four opponents on a debate stage. But he appeared to become more relaxed on stage and to relish his place as the outsider on the left.

On foreign policy, he appeared somewhat out of his element on a stage that included a former secretary of state, Clinton, and a former Navy secretary, James Webb, who also is a former Virginia senator.

Sanders was pressed on whether he could lead the military considering he applied for conscientious objector status during the Vietnam War.

“When I was young man — I’m not a young man today — I strongly opposed the war in Vietnam,” Sanders said. “That was my view then. . . . I am not a pacifist.”

Sanders said he has supported some U.S. military interventions, including President Bill Clinton’s decision to intervene in the war in Kosovo. “War should be the last resort,” he said. “We have got to exercise diplomacy.”

Democratic presidential candidate Bernie Sanders responded to a question about Hillary Clinton's e-mails. (CNN)

Sanders appeared more confident in the second half of the debate, finding his voice on key economic and fiscal issues, such as expanding Social Security. He carved out time to talk about his idea of making college free for every student and was able to put Clinton on the defensive over Wall Street reform.

Yet even here, as Sanders was calling for “a political revolution,” Webb tried to bring him down to earth: “I don’t think a revolution is going to come, and I don’t think the Congress is going to pay for a lot of this stuff.”

The debate moderator, CNN’s Anderson Cooper, challenged Sanders’s electability as a democratic socialist, noting, “You supported the Sandinistas in Nicaragua, you honeymooned in the Soviet Union, and just this weekend, you said you’re not a capitalist.”

“The Republican attack ad against you in a general election — it writes itself,” Cooper added.

Sanders responded: “Well, we’re going to win because first, we’re going to explain what democratic socialism is. And what democratic socialism is about is saying that it is immoral and wrong that the top one-10th of 1 percent in this country own almost 90 percent — almost — own almost as much wealth as the bottom 90 percent. That it is wrong, today, in a rigged economy, that 57 percent of all new income is going to the top 1 percent.”

Sanders has surged to a polling lead in the first-in-the-nation primary state of New Hampshire and is generating grass-roots momentum nationwide. He arrived in Las Vegas with a target on his back, and he took his share of hits throughout the debate, not only from Clinton but also from O’Malley.

On the issue of guns, suddenly prominent in the wake of the Oregon community college massacre, Clinton came ready to attack. She pointed out that Sanders voted as a House member in 1993 against the landmark Brady bill, which mandated federal background checks on firearms purchasers. She also brought up his vote in 2005 to shield manufacturers from lawsuits brought by victims of gun violence.

“I voted against it,” Clinton said of the immunity bill. “I was in the Senate at the same time.”

Sanders defended his record by explaining that he represents a rural state with a rich hunting tradition and that his constituents see the issue differently than people in urban states. He said he had a “D-minus” rating from the National Rifle Association. And he called for comprehensive legislation to “keep guns out of the hands of people who should not have those guns and end this horrible violence that we are seeing.”

O’Malley pounced, noting that his own NRA rating was lower — an “F” — and that despite Maryland’s rural as well as urban areas, he brought his state together to pass a sweeping 2013 gun-control bill. It included new fingerprinting requirements for handgun purchases and a ban on 45 types of assault rifles.

“We did it by leading with principle, not by pandering to the NRA and backing down to the NRA,” O’Malley said.

On the campaign trail the past few months, Sanders has struggled to make inroads with African American voters — a powerful constituency in the Democratic primaries — and make a convincing case on criminal justice issues. As a white senator representing a rural state that is 95 percent white, Sanders has little political experience navigating racial issues, despite his long history of supporting civil rights, including his advocacy in the 1960s movement.

In Tuesday’s debate, Sanders had strong comments about the racial issues that have roiled the nation. Answering a question submitted via Facebook from a young black man, Sanders stated unequivocally, “Black lives matter. And the reason those words matter is the African American community knows that on any given day, some innocent person like Sandra Bland can get into a car and then three days later she’ll end up dead in jail.”

He added, “We need to combat institutional racism from top to bottom.”