Sen. Bernie Sanders of Vermont and former Vice President Joe Biden, two front-runners in the Democratic presidential race, are mounting a late push to gain a decisive advantage in the early primary and caucus states, aiming to avert a monthslong delegate battle against two insurgent rivals — and each other.

Sanders and Biden appear nearly deadlocked in the early states with Sen. Elizabeth Warren of Massachusetts and former Mayor Pete Buttigieg of South Bend, Ind. Sanders held a slim lead in Iowa in a poll published Friday by the Des Moines Register and CNN, while recent polls in New Hampshire have found the leading candidates closely bunched. Biden has held a more consistent advantage in Nevada and South Carolina, the other states to vote in February.

In a sign of how extraordinarily fluid the race remains less than a month before voting, all four of the top candidates are in a position to win both Iowa and New Hampshire, an outcome that could transform the race for any of them.

Biden, the leading candidate in national polls, is especially determined to deny his challengers a chance to seize sudden momentum in the first few primary and caucus states. Hopeful of an early victory, Biden quietly dispatched his deputy campaign manager, Pete Kavanaugh, to move to Des Moines late last year to oversee his Iowa campaign. And in recent weeks Biden has made Iowa the most urgent priority on his travel schedule.

His support in the state has remained flat, however, and he will need a late surge to win the Feb. 3 caucuses. In the Register poll Friday, Sanders held the lead there with 20%, followed by Warren at 17%, Buttigieg at 16% and Biden at 15%. The poll, which had a margin of error of 3.7 percentage points, is likely to both embolden supporters of Sanders and galvanize moderate Democrats who are fiercely opposed to his nomination.

This is the first time that Sanders, 78, has finished atop the Register poll, another sign that he has reinvigorated his campaign just three months after having a heart attack. Jeff Weaver, a senior adviser to Sanders, said Friday night that the campaign was “extremely encouraged” by the poll and that Sanders was focused on driving up turnout in the caucuses.

“Clearly the trajectory is in the right direction,” Weaver said, adding, “If we have a big caucus turnout, Bernie Sanders will win the Iowa caucuses.”

Both Sanders and Biden have been seeking to take control of a race that has been shaken and shaped for much of the year by candidates with fresher faces and new ideas. Warren and Buttigieg are chief among them, having built strong campaigns in Iowa and New Hampshire and each seizing the lead there for a time. Now, both are girding for a monthslong quest for delegates across 50 states.

Against a backdrop of impeachment in Washington and violence in the Middle East, Sanders and Biden are trying to turn President Donald Trump’s clash with Iran to their own advantage in Iowa, a Midwestern state with strong strains of antiwar sentiment and ideological moderation. Sanders has used his powerful financial position to mount the largest advertising campaign of any candidate in the state, and he has been emphasizing his long antiwar record while delivering increasingly pointed criticism of Biden’s past support for foreign trade deals and the 2003 invasion of Iraq.

Biden has begun airing ads in Iowa calling this “the most dangerous moment in a generation,” and at a speech in New York last week he sought to re-engage in a direct debate not with his primary rivals but with Trump. At a meeting of political donors in New York on Wednesday, close advisers to Biden argued that the atmosphere of crisis would work to his advantage, people who attended the meeting said.

Both men brought valuable advantages into the race from the start, including sharply defined public images, Biden’s popularity among black voters and Sanders’ immense donor base. Biden has consistently led the field in national polls, while Sanders has been by far the most successful fundraiser, collecting nearly $35 million in the last quarter of 2019.

“The story of the race is the resilience of those two guys,” said Paul Begala, a longtime Democratic strategist.

But Biden’s advisers privately concede that a fourth-place finish could be damaging, and the Register poll indicated that he could capture political gold or be out of the medal hunt there altogether.

“If Biden were to finish first in Iowa and then first or second in New Hampshire, it’s very hard to see him being stopped,” said David Plouffe, who ran former President Barack Obama’s 2008 campaign.

The same could be true of Sanders: His campaign believes he is well positioned to win three of the first four states — with the Biden stronghold of South Carolina as the lone holdout — and then cement his control of the race on Super Tuesday, when Sanders’ financial strength and popularity with Latino voters could give him an edge in states like California and Texas.

But Sanders allies concede that he will have to add more support from racial minorities, especially black voters, in order to clinch the nomination.

“The hope is that our momentum gives people a chance to look at Bernie’s record on civil rights, on mass incarceration, on a lot of other issues,” said Rep. Ro Khanna of California, a co-chairman of the Sanders campaign.

Unlike Biden, Sanders would have to overcome deep reservations in the party establishment about his strength as a general-election candidate.

“Bernie is a disaster for me in South Florida,” said Rep. Donna Shalala, a first-term Democrat who faces re-election in a swing district where Sanders’ embrace of socialism is deeply unpopular with many Latino voters. Shalala, who has not endorsed a candidate, suggested the nomination might be resolved in a brokered convention and predicted Sanders would “stay in the primary right down till the end.”

For all his team’s optimism, Biden has yet to gain ground in Iowa and is no better than tied for the lead in New Hampshire, and his campaign could be stretched thin in bigger primary states, where he has done less than his top rivals to build out operations. Even some allies of Biden concede that Sanders and Warren have superior campaign organizations in many of the February and March voting states.