Joe Biden and Bernie Sanders’ political teams on Thursday announced a deal that would allow Sanders to keep hundreds of convention delegates he would have otherwise had to forfeit after suspending his White House bid.

The agreement between the former vice president and the populist senator from Vermont avoids what could have been a messy political fight between the presumptive Democratic presidential nominee and Sanders, who was Biden’s last remaining primary rival.

NEARLY A QUARTER OF SANDERS SUPPORTERS NOT BACKING BIDEN YET: POLL

The deal may also put to rest fears of a repeat performance of the divisive 2016 primary between Sanders and eventual nominee Hillary Clinton that led to a cold peace during the general election. Many Sanders supporters refused to vote for Clinton in the November election, which helped Donald Trump win the White House.

The two teams praised the deal, saying in a joint statement: “We must defeat Donald Trump this fall, and we believe that this agreement will help bring the party together to get Trump out of the White House and not only rebuild America, but transform it.”

Sanders has 952 delegates for this summer’s Democratic National Convention, won in the 2020 primaries and caucuses held to date. Biden has 1,428.

But under Democratic Party rules, Sanders would lose about a third of those delegates as some of the states that have already held nominating contests move forward with the delegate selection process. That’s because the national party’s rules state that candidates who drop out of the race before the state delegate selection process is finished would lose a portion of their delegates, which would be reallocated to the remaining candidates.

Since Biden is the only remaining candidate in the race, he would get those Sanders delegates. The rules apply not just to Sanders but to all the candidates who won delegates before exiting the race.

Democratic presidential candidates win delegates based on the percentage of their votes in primaries and caucuses. The majority of those delegates are won based on the primary or caucus results in individual congressional districts within the states. But just over a third of delegates are divvied up based on statewide results. It’s those delegates that are at issue.

THE LATEST FROM FOX NEWS ON THE 2020 PRESIDENTIAL CAMPAIGN

A joint memo from the Biden and Sanders teams – which was first reported by the AP -- says the reallocation will still happen with Biden getting all the delegates. But the Biden campaign has agreed to work with Sanders’ team to make sure that the delegates he’s losing to reallocation will still be filled by supporters of the progressive senator.

“While Senator Sanders is no longer actively seeking the nomination, the Biden campaign feels strongly that it is in the best interest of the party and the effort to defeat Donald Trump in November to come to an agreement regarding these issues that will ensure representation of Sanders supporters and delegate candidates, both on the floor and in committees,” the memo states.

Sanders suspended his presidential campaign earlier this month and endorsed Biden a week later.

But Sanders pledged to keep his name on the ballot in all upcoming primaries and caucuses to accumulate as many delegates as possible at this summer’s convention. The more delegates Sanders wins, the more influence he and his legions of younger and progressive supporters will have on the party’s platform and rules, which will be voted on during the convention.

The new accord states that the two campaigns “agree that Standing Committee slots will be filled by supporters of the Biden and Sanders campaigns based on the candidates’ respective statewide results.”

SANDERS URGES DNC STRIP NY OF ITS DELEGATES AFTER STATE SCRAPS PRESIDENTIAL PRIMARY

The deal comes a day after Sanders urged the Democratic National Committee (DNC) to strip New York state of all its delegates at this summer’s convention after the state scrapped its June 23 presidential primary.

On Monday, the New York State Board of Elections effectively cancelled the presidential primary when the two Democratic commissioners on the panel voted to strip off the ballot every candidate that wasn’t actively campaigning for president. That left Biden as the only contender on the ballot. The move, if it stands, would effectively give all 274 delegates at stake in the state’s Democratic presidential primary to Biden, since he would be the only candidate remaining on the ballot. The action came a day after Sanders had urged New York officials to let his name remain on the ballot.

While the state’s still holding down ballot primary contests, New York Democratic Party Chair Jay Jacobs said canceling the state’s presidential primary would mean a lower expected turnout and a reduced need for polling places amid the coronavirus pandemic. Americans have been urged to practice social distancing, and most people are staying in their homes to prevent the spread of the virus.

“It just makes so much sense given the extraordinary nature of the challenge,” Jacobs said last week.

No other contest is on the ballot in about 20 of the state’s 62 counties on June 23, meaning voters in those counties will have no need to go to the polls on that day.

The DNC told Fox News that once the state party submits an updated selection plan on how they plan on allocating delegates, the national party will look at that plan and make a determination.

The new agreement between Biden and Sanders states that “the campaigns are aware of the New York Board of Elections decision not to hold a presidential preference primary, and if the state remains eligible for delegates, the campaigns are committed to working together to ensure representation for Senator Sanders in the New York delegation.”

Fox News' Madeleine Rivera contributed to this report.