By Madeline HalpertBBC News

Getty Images Joe Biden and Kamala Harris walk in front of campaign promotion materials in North Carolina in MarchGetty Images

President Joe Biden surprised American voters on Sunday when he announced he would drop out of the race for president after weeks of resisting calls to step down.

Though he will carry out the rest of his presidency, he has endorsed Vice President Kamala Harris to take his place as the Democratic Party’s nominee.

The decision throws the party into uncharted waters with just a month to go before the Democratic National Convention.

Here’s a guide to what could come next.

What happens now?

The last time an incumbent US president abandoned their campaign for re-election was Lyndon Baines Johnson in 1968. As a result, the path for nominating a new candidate so close to Election Day is unclear.

President Biden had already won 3,896 pledged delegates during Democratic primary contests. That is much more than the amount needed to secure his party’s nomination.

Those delegates voted for a Biden-Harris ticket previously, but it will ultimately be up to them to decide which candidate they are backing as the Democratic nominee during the party’s convention next month.

While Mr Biden’s endorsement makes Ms Harris the most likely pick for the nominee, it is not fully certain what will happen after he releases his delegates.

Could there be an open convention?

The Democratic National Convention is scheduled to begin on 19 August.

If the Democratic Party does not come together to support a new candidate, that could set the stage for an open convention for the first time since 1968.

That would mean delegates would be free to decide who to vote for among multiple candidates if they emerge.

Candidates would need signatures from at least 300 delegates – no more than 50 coming from one state – for their name to appear on the ballot.

There would be an initial round of voting among the 3,900 pledged delegates, which includes voters deemed loyal to the Democratic party.

If no candidate receives a majority of votes after this first round, then more rounds of voting would take place. These rounds of voting would include superdelegates – party leaders and elected officials – who would all cast ballots until a nominee is chosen.

To secure the party nomination, a candidate needs 1,976 delegate votes.

Who might challenge Ms Harris?

As calls grew for Mr Biden to drop out of the race in recent weeks, a number of potential replacements emerged.

Michigan’s Democratic Governor Gretchen Whitmer has been floated as a candidate, though she has said she would not consider running if Mr Biden stepped aside. On Sunday, minutes after Mr Biden’s announcement, she said she would do everything she can “to elect Democrats and stop Donald Trump”.

And some other rumoured replacements have since rallied behind Ms Harris – including California Governor Gavin Newsom, Transportation Secretary Pete Buttigieg and Pennsylvania Governor Josh Shapiro.

Some of these candidates could be considered for the role of vice president if Ms Harris does ultimately win the nomination.

Red and blue banner with white stars