WEST DES MOINES — Sen. Bernie Sanders faced a sudden barrage of attacks from his rivals Sunday amid signs that he was surging in the critical early-voting states of Iowa and New Hampshire and closing the gap nationally with the race’s longtime polling leader, Joe Biden.

Sanders’s rise, with only days left before the Feb. 3 caucuses here, prompted urgent warnings from competing campaigns that the party is in jeopardy of nominating a self-identified democratic socialist whose far-left views would turn off the broad swath of voters required to defeat President Trump in the November general election.

“Bernie Sanders could be the nominee,” the campaign of Pete Buttigieg declared in an ominous-sounding fundraising message to supporters Saturday. A pointed text message followed on Sunday: “We risk nominating a candidate who cannot beat Donald Trump in November. And that’s a risk we can’t take.”

The focus on Sanders represents a shift from much of the past year in which the top candidates largely ignored the senator from Vermont, wagering that there was little benefit in fighting with a candidate with a loyal following but who might not be able to build on it. The more traditional campaigns — mainly those of Biden, the former vice president, and Buttigieg, the former mayor of South Bend, Ind. — focused more on trying to siphon support from Sen. Elizabeth Warren (D-Mass.), who was ascendant in the summer and early fall but has dropped in recent months.

The dynamic underscores the remarkable nature of Sanders’s candidacy, which seemed doomed as recently as October after the 78-year-old suffered a heart attack. Since then, Sanders has become re-energized, with new endorsements and surveys that suggest he has the chance to expand his base of support.

Several new public polls have shown Sanders on the rise, particularly in Iowa and New Hampshire, where he appears to have taken the lead. A national Washington Post-ABC News poll published over the weekend showed Biden and Sanders in the clear top spots nationally — with Biden at 32 percent and Sanders at 23 percent among Democratic-leaning registered voters.

Much of the intensifying debate over Sanders over the weekend centered on his ability — or lack thereof — to beat Trump. The discussion once again laid bare the argument that has vexed a Democratic Party desperate to beat the president, but unsure whether the best path to victory means energizing liberal voters eager for a “political revolution,” as Sanders promises, or nominating a more centrist candidate who can piece together a left-center coalition.

The polling on that question is not conclusive. A Post average of national surveys dating back to December shows that Biden leads Trump 48 percent to 43 percent, while Sanders’s edge is a slightly narrower 47 percent to 44 percent for Trump.

Sen. Amy Klobuchar (D-Minn.), who has presented herself as a moderate best able to defeat Trump, seized a chance to make the electability argument on national television Sunday — telling ABC News that Sanders’s Medicare-for-all plan puts him out of step with voters in many more moderate or conservative parts of the country that might be open to voting Democratic in November.

“When you look at what just happened in the last election, as well as those governor races in Kentucky and Louisiana, look what happened,” Klobuchar told ABC News. “Those were candidates where Democrats won in states that were red, states that were purple, like Michigan, like Kansas, congressional races all over the country that fit the district, that fit that the state, that did not suggest blowing up our current health system and kicking 149 million Americans off their current health insurance in four years.”

A more cutting critique came Sunday from another candidate, former New York mayor Mike Bloomberg, who seemed to mock Sanders’s political ideology during a South Florida speech to Jewish voters.

“I know I’m not the only Jewish candidate running for president. But I am the only one who doesn’t want to turn America into a kibbutz,” he said, a reference to the socialism shared by Sanders and the Israeli collective farm where Sanders worked decades ago.

Biden, who has long argued that Democrats need to choose a nominee who can help Democrats win back swing-state voters, took subtle steps that seemed designed to create contrasts with Sanders.

After Sanders was criticized for promoting the endorsement of podcast host Joe Rogan, who has made disrespectful remarks about the transgender community, Biden tweeted Saturday: “Transgender equality is the civil rights issue of our time. There is no room for compromise when it comes to basic human rights.”

Biden, meanwhile, continued to roll out endorsements from elected Democrats in the early states, underscoring his appeal in the middle of the party.

Rep. Cindy Axne (D-Iowa), who offered her high-profile endorsement to Biden on Saturday, said a “pragmatic” platform is key to fostering victories like hers in down-ballot races moving forward.

“I can tell you from flipping a seat here a year ago, you do not win seats in purple districts like ours without a top of a ticket that actually supports the values the people in this country want to see as far as leadership,” Axne said in an interview Sunday.

Sanders and his campaign have grown more explicit in their arguments for why they believe he would be the strongest opponent for Trump.

The senator, after all, leads what has effectively become a political movement — one that would surely mobilize for Sanders if he were the nominee but that remains an open question when it comes to turning out for a more establishment-oriented candidate. Many stayed home in 2016 rather than vote for Hillary Clinton, who had defeated Sanders in a bitter primary that year.

“In terms of electability, which is a fair question, we need a campaign which has energy, which has excitement, which has a strong grass-roots movement, which is able to raise money from working families to campaign and not just billionaires and Wall Street executives,” Sanders said Saturday at a rally in Ames, Iowa, that drew some 1,400 people, including 400 in an overflow room set up in an adjacent gymnasium.

The argument is being echoed by one of Sanders’s most prominent supporters, Rep. Alexandria Ocasio-Cortez (D-N.Y.), a star on the political left, who argued during appearances here that many voters in the heartland would be drawn to Sanders’s message.

“I almost get insulted on behalf of people” when they say what will or won’t win the Midwest, Ocasio-Cortez said Saturday in Marshalltown, Iowa. She argued that because of the economic struggles that many people are experiencing, “radical change is exactly what we need now.”

On Sunday, Ocasio-Cortez pushed back against critics who say Sanders would alienate some voters.

“I don’t think he’s divisive,” she said. “I think he distinguishes himself. I think he’s very clear about who he is.”

Another Sanders backer, liberal filmmaker Michael Moore, brought along a printed list of campaign events that Sanders did for Clinton after losing to her in 2016, clearly designed to allay lingering anger that Sanders didn’t do more to press his supporters to turn out. “He went and held on his own 42 rallies to get out the vote for Hillary,” Moore said.

Sanders has sought to turn the sudden hostility he is facing into a battle cry that he hopes will energize his base to turn out in large numbers on caucus night.

“The big-money interests are getting very nervous,” he said, prompting cheers. “They’re looking at recent polls in New Hampshire and in Iowa, and they’re saying, ‘Oh, my god, Sanders can win.’ ”

Annie Linskey, Cleve R. Wootson Jr., Emily Guskin and Julie Zauzmer contributed to this report.