President Donald Trump walked into a carefully laid trap on Wednesday, when, in an interview on CNBC, he suggested he was open to cutting Social Security and Medicare.

Asked by “Squawk Box” host Joe Kernen whether “entitlements” ― a Washington term for universal social insurance programs ― would ever be “on his plate,” Trump responded that they would.

“At some point they will be,” Trump said in the interview from Davos, Switzerland. “At the right time, we will take a look at that.”

It’s unclear if Trump even knew of exactly what he was speaking.

And the White House denied that was his intention. “With no benefit cuts, President Trump is keeping his commitment to the most vulnerable Americans, especially those who depend on Medicare and Social Security,” White House spokesman Judd Deere said.

But Sen. Bernie Sanders (I-Vt.), who is vying for the chance to take on Trump as the Democratic presidential nominee, didn’t waste time using it against him.

“Over and over, Donald Trump promised Americans that he would not cut Social Security and Medicare. He lied,” Sanders tweeted. “When we win, we’re not going to just protect Social Security and Medicare, we’re going to expand them.”

After HuffPost’s story went live Thursday afternoon, Trump defended his record further on Twitter. “Democrats are going to destroy your Social Security,” he wrote. “I have totally left it alone, as promised, and will save it!”

Sanders shot back in a quote-tweeted message with a screenshot of an article documenting how Trump’s budget resolutions have sought to cut the program. “More lies,” Sanders wrote.

Mark Wilson/Getty Images Sen. Bernie Sanders (I-Vt.) introduces a bill to expand Social Security on Capitol Hill in February.

The timing of Trump’s comments to CNBC could not have come at a more opportune moment for Sanders, who is litigating a pitched battle with former Vice President Joe Biden, with whom he is neck-and-neck in the presidential primary, over their respective records on Social Security.

The Biden campaign affirmed to HuffPost on Saturday that in addition to proposing a plan to increase Social Security benefits for the most vulnerable retirees, Biden has ruled out cuts of any kind to the benefits received by the larger beneficiary population.

But Sanders is correct to note that as a senator in the 1980s and ’90s, Biden endorsed and even cast votes for legislation that cut or would have cut Social Security benefits. He also served alongside former President Barack Obama, who sought a budget compromise deal ― or “grand bargain” ― with congressional Republicans that would have reduced Social Security’s cost-of-living adjustment.

Sanders, by contrast, was an early opponent of those would-be deals and a proponent of expanding Social Security.

The Trump remarks provide Sanders the chance to further distinguish himself from Biden. Perhaps more importantly, they also give him the opportunity to execute on a carefully crafted plan to hold Trump accountable for his populist rhetoric.

Virtually since the moment Trump was elected, Sanders had been reminding Trump of his campaign trail promises not to cut Social Security, Medicare and Medicaid.

Sanders’ Senate office captured video of Trump mocking his fellow Republicans at an event in New Hampshire in May 2015 for embracing Social Security and Medicare cuts, and promising that he would be different.

He headlined a rally with Democratic leaders in Congress in December 2016 calling on Trump not to cut Medicare.

Bernie Sanders can speak to the reality that working-class people of all races in this country feel that Trump tried to appeal to in 2016 but in fact has failed to deliver on. Jeff Weaver, Sanders campaign

The following month, as it became clear that repealing the Affordable Care Act would be a Republican priority in Trump’s first months in office, Sanders printed out one of Trump’s tweets promising to protect Social Security, Medicare and Medicaid, and used it as a prop on the Senate floor.

“If he was sincere, then I would hope that tomorrow or maybe today he could send out a tweet and tell his Republican colleagues to stop wasting their time and all of our time,” Sanders said, standing alongside a poster of the tweet.

Sanders subsequently condemned every one of Trump’s annual budget proposals for trying to restrict eligibility for Social Security’s Disability Insurance program. He consistently framed those budgets as betrayals of Trump’s campaign promises.

“Donald Trump promised the American people that he would be a different type of Republican, that he would be a champion of the working American and that he would not cut Social Security, Medicare and Medicaid,” Sanders said in a statement about Trump’s fiscal 2020 budget in March. “But his budget does the exact opposite of what he promised the American people.”

It’s all part of Sanders’ argument ― however oversimplistic ― that Trump won by appealing to the struggles of millions of working-class people, who either abandoned the Democratic Party in favor of him or stayed home.

As a candidate, Trump indeed combined racist rhetoric and hard-line immigration policies with promises to bring back manufacturing jobs through more equitable trade agreements, protect social insurance programs, ensure universal health care, and “drain” Washington of its swamp-like corruption.

Sanders’ conceit is that as a left-wing populist, he is the perfect foil for Trump’s empty working-class pitch.

“On every issue, Trump has betrayed the working class of this country. His only signature legislative accomplishment is a massive tax bill for wealthy people and large corporations,” said Jeff Weaver, a senior adviser to the Sanders campaign. “That is why Bernie Sanders is so well positioned to take him on and defeat him in 2020 ― because Bernie Sanders can speak to the reality that working-class people of all races in this country feel, that Trump tried to appeal to in 2016, but in fact has failed to deliver on.”

Weaver argued that, less than two weeks before the Iowa caucuses, it makes Sanders the most electable candidate in the Democratic primary field.

“The only way that we’re going to be able to do that is by increasing the voter turnout, energizing young people ― particularly young people of color, and bringing working-class people back into the Democratic Party,” Weaver said. “That’s the agenda that Bernie Sanders has.”

He contrasted it with Biden’s pitch to roll back the clock on the Trump era and return to normalcy, which he predicted would have even less success than Hillary Clinton’s 2016 campaign.

“If we go back to that paradigm of Trump versus Joe Biden, who is in many ways more conservative in terms of working-class issues than Hillary Clinton was by far, how can you expect to have a different result?” Weaver asked.

By some measures, though, Biden is running on a more progressive platform than Clinton. For example, he is proposing a public health insurance option for the entire population, whereas Clinton just proposed a public option for Americans who purchase coverage on the Affordable Care Act’s exchanges.

Biden also is not a stranger to running against Republicans by warning that they’ll cut Social Security and Medicare.

“Mark my words, if we don’t win back the House and Senate, they’re going to drastically cut Social Security,” Biden said while campaigning for Democratic congressional candidates in October 2018.

Andrew Bates, a spokesman for Biden’s campaign, said that the former vice president has “an unparalleled record of delivering progressive change,” including the 2009 economic stimulus package, the ACA and the passage of two major gun safety regulations.

Bates also noted that Sanders praised Biden in 2015 as “a man who has devoted his entire life to public service and to the well-being of working families and the middle class.”

“Donald Trump just got himself impeached because he’s so terrified of running against Joe Biden that he became the only president in American history to attempt to force a foreign country to lie about a political rival,” Bates concluded.

Arthur Delaney contributed reporting.

This article has been updated with Trump’s tweet later Thursday defending his record on Social Security.