White House press secretary Josh Earnest said Thursday it’s up to Democratic presidential candidate Bernie Sanders Bernie SandersNYT editorial board remembers Ginsburg: She 'will forever have two legacies' Two GOP governors urge Republicans to hold off on Supreme Court nominee Sanders knocks McConnell: He's going against Ginsburg's 'dying wishes' MORE to decide when and how he ends his campaign.

ADVERTISEMENT

"Sen. Sanders has more than earned the right to make his own decision on his own timeframe about the future of his campaign and the president certainly respects the important work that Sen. Sanders has done on the campaign trail," Earnest said during a press briefing on Thursday.

But that statement came shortly after President Obama formally endorsed Hillary Clinton Hillary Diane Rodham ClintonJeff Flake: Republicans 'should hold the same position' on SCOTUS vacancy as 2016 Momentum growing among Republicans for Supreme Court vote before Election Day Warning signs flash for Lindsey Graham in South Carolina MORE, a move that is likely to suck the remaining energy from the Vermont senator’s campaign.

The video endorsement was released just an hour after Obama met at with Sanders at the White House, and it was recorded on Tuesday, after The Associated Press announced Clinton had won the delegates necessary to clinch the nomination.

It did not come as a surprise to the Vermont senator.

Earnest said Obama gave Sanders a heads-up, noting that the two men spoke three times in the past week.

"As a result of those conversations, I think it’s fair to say that Sen. Sanders was not at all surprised by today’s announcement," Earnest told reporters.

But the White House press secretary was sure to add that Obama, “certainly respects the strong support that [Sanders] built in all 50 states,” noting “that means that Sen. Sanders get to decide what the future of his campaign looks like."

The Vermont senator said he’ll stay in the race and did not endorse Clinton ahead of a scheduled Washington, D.C., rally Thursday evening. But he said he plans to work with Clinton to fight presumptive GOP nominee Donald Trump Donald John TrumpUS reimposes UN sanctions on Iran amid increasing tensions Jeff Flake: Republicans 'should hold the same position' on SCOTUS vacancy as 2016 Trump supporters chant 'Fill that seat' at North Carolina rally MORE.

“Needless to say, I am going to do everything in my power, and I will work as hard as I can to make sure Donald Trump does not become president of the United States,” Sanders said.

Earnest said that during the meeting, Sanders and the president discussed the importance of making sure Obama is succeeded by a leader who is committed to building on the progress the country has made.

He said he thinks both the Vermont Independent and the president are "enthusiastic" about what lies ahead and are looking toward the future of the Democratic Party.