Democratic presidential candidate Hillary Clinton challenged rival Bernie Sanders’s stance on gun control during a campaign event in Ames, Iowa, on Tuesday. (Reuters)

A newly aggressive Hillary Clinton emerged here this week and her campaign took on fresh urgency as polls suddenly showed the Democratic presidential front-runner in real danger of losing the first two primary contests to insurgent rival Bernie Sanders.

Here in Ames, Clinton launched her sharpest attacks yet by ripping into Sanders on issues such as health care and gun control. She portrayed the senator from Vermont as naive and his proposals as unrealistic — and, seeking to undermine the central argument of his candidacy, alleged that he could not be trusted to take on entrenched interests.

“If you’re going to go around saying you’ll stand up to special interests, well, stand up to the most powerful special interest — stand up to that gun lobby,” Clinton said, citing Sanders’s 2005 vote to grant immunity to gun manufacturers.

“Don’t talk to me about standing up to corporate interests and big powers,” she added. “I’ve got the scars to show for it, and I’m proud of every single one of them.”

Later Tuesday, the campaign released a new ad in which Clinton doesn’t mention Sanders by name but implicitly criticizes him by saying “it’s time to pick a side” — with or against the gun lobby. “I’m with him,” Clinton says of Obama, suggesting that Sanders is not.

Democratic presidential candidate Bernie Sanders addresses cheering supporters at a rally at the Des Moines Area Community College in Ankeny, Iowa, on Sunday. (Scott Morgan/Reuters)

Although Clinton and Sanders have been tweaking each other since the fall, the Democratic contest has been a sleepy affair compared with the rollicking Republican race. But it is coming to life ahead of a debate Sunday, the last before the Feb. 1 caucuses here.

Clinton has seemed this week to relish playing the aggressor in what she has dubbed the “let’s get real” period of the race. Sanders has been drawing contrasts, too, ticking off differences with Clinton on Social Security, energy and other policies at his rallies.

Clinton’s combative approach is part of a broader effort by her campaign and her allies to blunt Sanders’s apparent momentum. Her campaign has begun flooding Iowa and New Hampshire with a wave of surrogates that includes her husband, former president Bill Clinton; their daughter, Chelsea; Lena Dunham, the star of the HBO series “Girls”; and a troupe of female senators.

Clinton has also rolled out major endorsements this week designed to highlight her differences with Sanders on gun safety: Gabrielle Giffords, the former congresswoman who survived a 2011 assassination attempt in Arizona, and the Brady Campaign to Prevent Gun Violence.

The former secretary of state has tried to highlight her perceived electability, her ability to withstand Republican attacks in the general election and her readiness to occupy the Oval Office. She recalled at length in Ames her time in the White House Situation Room during the Osama bin Laden raid — “one of the most tense days of my life,” she said.

Campaign officials said they long expected the race to be close, and her organization is designed for a protracted battle well past the Super Tuesday contests in March. In Iowa specifically, the Clinton team is confident that its organizational muscle and data-driven strategy will prevail.

Stump speeches by GOP presidential candidates reveal that they’re planning for a race against Hillary Clinton in the general election. (Peter Stevenson/The Washington Post)

“Since the campaign started, we have said this race will be a competitive, tough race that would tighten and we’d have to earn the nomination,” spokesman Jesse Ferguson said. “We have built a tremendous grass-roots organization in Iowa fueled by enthusiasm for Hillary Clinton and her record that is set to compete and win.”

In New Hampshire, Sanders enjoys a home-field advantage as a neighboring senator and has been tied or leading in the polls for months. But he is showing new strength in Iowa, where Clinton’s lead appears to have vanished, and is also catching up in national surveys. A Quinnipiac University poll released Tuesday showed Clinton trailing Sanders here, 49 percent to 44 percent.

Despite Clinton’s frequent visits, army of community-based organizers and early investment in TV advertisements, she does not appear to have captured people’s imaginations the way Sanders has.

The crowds at his town hall meetings have swelled even beyond his campaign’s expectations. In high school gyms and community centers across the state, Sanders has been feverishly embraced by a mix of young and older voters in recent days. People wave dark-blue signs handed out by the campaign promising “A Future to Believe In,” and many leave saying they are excited about caucusing on his behalf.

Danniella Vajgrt, 33, said she had been leaning in Clinton’s direction but decided Sunday to caucus for Sanders after hearing him speak in Marshalltown.

“I’m seeing all these things broken in this nation, and these are the things he wants to fix,” said Vajgrt, who works with special-needs children and adults.

Not everyone who attended the Sanders event at a roadside Best Western was ready to commit to him, however. Elly Mack, 62, a nurse, said she was moving his way, in part because of his sincerity, but she doubts he can win the nomination. “I’m pretty sure Hillary is going to be the candidate,” Mack said. “I like her experience, but I’m just not quite there.”

Even before Christmas, some top Clinton supporters here were growing nervous, both because of Iowa’s history of volatility in the closing weeks before the caucuses and because they saw Sanders as primed for a late surge.

There have been hints of those qualms in recent fundraising appeals from Clinton campaign manager Robby Mook. “I’m not trying to be dramatic about this (I swear! I’m really not!), but there’s a situation developing in Iowa and New Hampshire that could change the course of this election,” he wrote last week.

Clinton remains the favorite to secure the nomination, in part because of Sanders’s inability so far to make inroads with minority voters. But if she were to fall short in Iowa and New Hampshire, she would have to brace for a costly slog — and, should she prevail, risk entering the general election as damaged goods.

“This is going to be a long nomination process,” said Sanders campaign manager Jeff Weaver. “There’s no knockout blow by either candidate at the beginning of this race.”

In some quarters of the Democratic firmament this week, there have been fresh signs of uneasiness with Clinton’s candidacy. Vice President Biden, who decided against a campaign of his own last fall, praised Sanders in a CNN interview Monday and said that while “no one questions Bernie’s authenticity” on income inequality, the subject was “relatively new for Hillary to talk about.”

“I never thought she was a prohibitive favorite,” the vice president said, adding, “Everything’s sort of coming down to Earth.”

The fluid state of play in Iowa brought uncomfortable flashbacks for Clinton, who finished in a crippling third place in the 2008 caucuses. In her Ames speech, she mused about how difficult it is for a president to implement his or her ideas in Washington, however wonderful they may sound on the campaign trail. It was an implicit dig at Sanders.

“I wish we could have a Democratic president who could wave a magic wand and say, ‘We shall do this, and we shall do that,’ ” she said. “That ain’t the real world we’re living in!”

Clinton used a similar “magic wand” line in 2008 to go after then-Sen. Barack Obama, saying he was naive for thinking he could unite Washington.

She is responding to the Sanders threat by trying to tap into the goodwill Democrats here still feel toward Obama, casting herself as his rightful heir and the dependable protector of his legacy.

One of Obama’s Cabinet members, Transportation Secretary Anthony Foxx, jetted to Waterloo on Monday to endorse Clinton. There, and again the next day in Ames, Clinton said Sanders’s single-payer, “Medicare for all” health-care proposal would jeopardize Obama’s Affordable Care Act by shifting health-care decisions to the states, many of which have Republican governors.

Addressing a few hundred Democrats on the frozen campus of Iowa State University, Clinton mocked Sanders’s mantra of a “political revolution” and said, “If that’s the kind of ‘revolution’ he’s talking about, I’m worried, folks.”

Chelsea Clinton echoed her mother at a campaign stop Tuesday in New Hampshire, saying that “Sanders wants to dismantle Obamacare” and “strip millions and millions and millions of people off their health insurance.”

Sanders spokeswoman Arianna Jones said these attacks are “wrong.” Though Sanders has not released the specifics of his single-payer plan, Jones said it would provide health care to every man, woman and child, and save middle-class families $5,000 a year.

At the Brown and Black Presidential Forum on Monday in Des Moines, co-moderator Jorge Ramos, a Univision news anchor, asked Sanders if he had noticed Clinton becoming more aggressive.

“Yessssss,” the senator said, drawing out the word. “It could be that the inevitable candidate for the Democratic nomination may not be so inevitable today.”

Wagner reported from Marshalltown, Iowa. Anne Gearan in Washington contributed to this report.