Hillary Clinton’s supporters must have been hoping it was not a glimpse of the future.

Bernie Sanders, the man once dismissed as a white-haired socialist senator from a tiny state, found himself centre stage on Wednesday as he marched into the White House.

His private 45-minute meeting with Barack Obama at the Oval Office came just days before the Iowa caucuses, where, once unthinkably, polls show Sanders running neck and neck with Clinton for the Democratic nomination. He has a clear lead in the next contest, in New Hampshire on 9 February.

Sanders emerged with from the West Wing in a winter coat with striped tie and a smile. He told reporters he talked foreign policy, the economy and “a little bit of politics” during a “constructive” conversation with Obama, their first extended meeting since the Vermont senator became a serious contender for the Democratic nomination.

Speaking in the White House driveway, the anti-establishment figure laughed as he said he did not directly ask for Obama’s endorsement. The president recently praised Clinton’s pedigree in an interview with Politico while noting that Sanders had the “luxury of being a complete long shot” and was a “bright, shiny object” in need of some more scrutiny.

But Sanders said: “There was some discussion the other day about a Politico interview where he was tipping the scales towards Secretary Clinton. I don’t believe that at all.

“I think he and the vice-president have tried to be fair and even-handed in the process and I expect they will continue to be that way.”

He acknowledged that he and the president had had differences, but insisted that he had largely backed Obama’s agenda. “In 2008, I did my best to see that he would be elected president, campaigned hard for him, as I did in 2012.”

He added: “We have got to do a lot better to protect the middle class and working families. But it’s also important to remember how far we’ve come under the leadership of President Obama and Vice-President Biden.”

Although Obama has remained studiously neutral in the Democratic race, as good form demands, the meeting – and its timing – was an opportunity for Sanders to gain credibility and gravitas. There have been predictions that, should he become the nominee, Republicans will dust off hammer and sickle imagery and raise fears of a socialist in the White House.

Commentators have also argued that while Sanders resembles Obama the grassroots campaigner, Clinton is a closer match to his pragmatic presidency. Obama and Sanders have little personal history together and the president’s aides have resisted suggestions that Sanders is a natural heir.

Despite his criticism of Obama on healthcare, Wall Street regulation and other economic issues, Sanders said that on the “major issues I have stood by his side” against Republican opposition.

The White House says Sanders and Obama first discussed holding this meeting at a White House Christmas party in late December and aides have been working on scheduling it since. It was a private meeting, with no photos or statements or formal agenda.

Clinton, meanwhile, visited the White House for an informal lunch on 7 December and had an hour-long meeting last March.