President Barack Obama wasn’t on the debate stage with the 10 Democratic presidential hopefuls Wednesday night — but his legacy was, and it was trashed by many of the candidates, leaving some Democrats scratching their heads in disbelief.

Obama’s record on immigration was widely criticized by the participants and his signature legislative achievement, the Affordable Care Act, became a casualty of the discussion around “Medicare for All,” as his former Vice President Joe Biden attempted to defend the administration’s work.

Eric Holder, Obama’s attorney general, warned Democrats to tread lightly.

“To my fellow Democrats. Be wary of attacking the Obama record. Build on it. Expand it. But there is little to be gained – for you or the party – by attacking a very successful and still popular Democratic President,” he posted on Twitter.

The Rev. Al Sharpton said Democrats piling on Obama would alienate the Democratic base.

​”This whole suicide mission of going after Barack Obama smells like desperation, and I think it certainly shows that some of them are just not ready for where they are​,​” ​he said.

During an appearance on CBS’ “The Late Show with Stephen Colbert,” Rahm Emanuel, Obama’s former White House chief of staff, warned Democrats on the stage not to toss aside how ObamaCare benefited Americans.

“I don’t know what the Democrats are doing,” Emanuel said. “It is very popular not only with the Democrats, it’s very popular with the country. And ready? It’s working — like breaking news! That’s what legislation is supposed to be doing. I don’t get it.”

GOP strategist Rick Wilson chalked it up to Democrats being inept at politics.

“People ask why I say Democrats are holistically bad at politics. I will always point to the fact that many of their leading candidates for 2020 spent last night taking a giant dump on Barack Obama.”

“It’s almost as if you’re trying to re-elect Trump, so go you.”

Republican consultant Terry Sullivan, a campaign manager for Sen. Marco Rubio, said it was “kinda nuts to watch.”

“Obama lost tonight. Apparently, his record is far too right-wing on the issues of health care and immigration,” he wrote for Politico.