Bernie Sanders has said he sees similarities between himself and Jeremy Corbyn as he praised the Labour leader for “revitalising democracy”.

The former US presidential candidate was speaking at the Cambridge Union during a visit to the UK.

Answering a question from The Independent, Mr Sanders claimed there were “similarities” between himself and Mr Corbyn.

He said: “What Corbyn has tried to do with the Labour Party is not dissimilar to what some of us are trying to do with the Democratic Party, and that is to make it a party that is much more open and inviting for working people and young people and not have a liberal elite making the decisions from the top down.

“I think what Corbyn is doing is trying to revitalise democracy, bring a lot of new people into the political process and I think that’s an excellent idea. That’s what we need in countries all over the world and certainly what we are trying to do in the United States.”

Mr Corbyn's team had been hoping the senator would endorse him during his visit. Mr Sanders stopped short of that, but praised the Labour leader for his “courage” in raising issues of economic inequality, saying it was easier to get people to support calls for equality on the grounds of gender, race and sexuality than it was to highlight economic divisions.

He said: “Corbyn has shown a lot of courage in dealing with some of the economic issues.

“If I were to give a speech about women’s rights, people would say, ‘That’s great Bernie’. If I were to give a speech about gay rights, people would say, ‘That’s great Bernie, we need to fight homophobia’. If I were to give a speech about combating racism, people would say, ‘That’s great, we cannot tolerate racism’ and people respond to that.

UK General Election 2017 Show all 47 1 /47 UK General Election 2017 UK General Election 2017 12 June 2017 British Prime Minister Theresa May leaves 10 Downing Street for the 1922 committee on June 12, 2017 in London, England. British Prime Minister Theresa May held her first cabinet meeting with her re-shuffled team today Getty Images UK General Election 2017 12 June 2017 DUP leader Arlene Foster stands alongside deputy leader Nigel Dodds as they hold a press conference at Stormont Castle as the Stormont assembly power sharing negotiations reconvene following the general election on June 12, 2017 in Belfast, Northern Ireland. Discussions between the DUP and the Conservative party are also continuing in the wake of the UK general election as Prime Minister Theresa May looks to form a government with the help of the Democratic Unionist parties ten Westminster seats. Stormont and the political situation in Northern Ireland has been in limbo following the collapse of the power sharing executive due to the Renewable Heat Incentive scheme scandal which implicated the DUP Getty Images UK General Election 2017 12 June 2017 Priti Patel, International Development Secretary leaves 10 Downing Street Getty Images UK General Election 2017 12 June 2017 Larry the Downing Street cat runs ahead of Michael Fallon Britain's Secretary of State for Defence as he arrives for a cabinet meeting at Downing Street in London, Britain, June 12, 2017. REUTERS/Stefan Wermuth REUTERS UK General Election 2017 12 June 2017 Michael Gove, Environment Secretary leaves 10 Downing Street on June 12, 2017 in London, England. British Prime Minister Theresa May held her first cabinet meeting with her re-shuffled team today Getty Images UK General Election 2017 12 June 2017 Scottish National Party Leader Nicola Sturgeon (C) leaves after speaking to the media in Parliament Square. Getty Images UK General Election 2017 12 June 2017 British Prime Minister Theresa May (C, L) holds the first Cabinet meeting of her new team. Getty UK General Election 2017 11 June 2017 British Prime Minister Theresa May attends church in her constituency with her husband Philip May, a few days after disappointing results in a general election. Rex Features UK General Election 2017 9 June 2017 Leader of the Labour Party Jeremy Corbyn leaves Labour Party HQ this morning, following a general election yesterday. Parliament is hung, with no individual party gaining an overall majority. Post general election reaction. Rex UK General Election 2017 9 June 2017 BELFAST, NORTHERN IRELAND - JUNE 09: DUP leader and Northern Ireland former First Minister Arlene Foster (C) holds a brief press conference with the DUP's newly elected Westminster candidates who stood in the general election Getty Images UK General Election 2017 9 June 2017 A " Get May Out" demo took place opposite the gates of Downing Street, calling for May to resign, after the shock election results and Mays coalition with the DUP. Rex Features UK General Election 2017 9 June 2017 A demonstrator wears a mask depicting Britain's Prime Minister and leader of the Conservative Party Theresa May, poses with a mock gravestone bearing the words "Hard Brexit, RIP", during a protest photocall near the entrance 10 Downing Street in central London AFP/Getty Images UK General Election 2017 9 June 2017 Britain's Prime Minister Theresa May arrives at the Conservative Party's headquarters in London Reuters UK General Election 2017 9 June 2017 Britain's Prime Minister and leader of the Conservative Party Theresa May flanked by her husband Philip delivers a statement outside 10 Downing Street in central Londo Getty UK General Election 2017 9 June 2017 Britain's Prime Minister and leader of the Conservative Party Theresa May leaves Buckingham Palace in London the day after a general election in which the Conservatives lost their majority Getty Images UK General Election 2017 9 June 2017 A TV cameraman watches the door of 10 Downing Street in London Getty Images UK General Election 2017 9 June 2017 Labour leader Jeremy Corbyn is greeted by his Office Director Karie Murphy as he arrives at Labour Party HQ in Westminster, London, after he called on the Prime Minister to resign, saying she should 'go and make way for a government that is truly representative of this country' Dominic Lipinski/PA Wire UK General Election 2017 9 June 2017 Britain's Prime Minister Theresa May arrives at the Conservative Party's headquarters with her husband Philip in London REUTERS/Peter Nicholls UK General Election 2017 9 June 2017 Ukip leader Paul Nuttall speaks during a press conference at Boston West Golf Club where he announced that he is standing down as party leader Joe Giddens/PA UK General Election 2017 9 June 2017 Ruth Davidson, leader of the Scottish Conservatives, leaves the counting centre for Britain's general election with her partner Jen Wilson in Edinburgh, Scotland REUTERS/Russell Cheyne UK General Election 2017 9 June 2017 Scottish Labour leader Kezia Dugdale celebrates with candidate for Edinburgh South Ian Murray as he retains his seat at the Meadowbank Sports Centre counting centre in Edinburgh, Scotland Getty Images UK General Election 2017 9 June 2017 First Minister Nicola Sturgeon speaks to the media at the Emirates Arena in Glasgow, as counting is under way for the General Election Andrew Milligan/PA Wire UK General Election 2017 9 June 2017 Scottish Conservative leader Ruth Davidson at Meadowbank Sports Centre in Edinburgh, as counting is under way for the General Election PA UK General Election 2017 9 June 2017 Scottish National Party (SNP) leader Nicola Sturgeon reacts at the Emirates Arena in Glasgow, Scotland EPA UK General Election 2017 9 June 2017 Jeremy Corbyn, leader of Britain's opposition Labour Party, arrives at the Labour Party's Headquarters in London REUTERS/Marko Djurica UK General Election 2017 9 June 2017 UKIP Leader Paul Nuttall leaves in a car following the vote count for the constituency of Boston and Skegness in Boston, England Anthony Devlin/Getty Images UK General Election 2017 9 June 2017 British Prime Minister and Conservative Party leader Theresa May speaks at the declaration at the election count at the Magnet Leisure Centre in Maidenhead, England. Getty Images UK General Election 2017 8 June 2017 A policer officer enters a polling station in London AP UK General Election 2017 8 June 2017 A woman leaves after casting her vote at the Hove Museum and Art Gallery near Brighton, in southern England Getty UK General Election 2017 8 June 2017 A polling station sign is seen on a telephone box outside the polling station at Rotherwick Hall, west of London Getty UK General Election 2017 7 June 2017 A woman walks past a general election display in the window of a betting shop in Camden on June 7, 2017 in London, United Kingdom. Britain goes to the polls tomorrow, Getty Images UK General Election 2017 7 June 2017 Britain's Prime Minister Theresa May visits Atherley Bowling Club during an election campaign visit on June 7, 2017 in Southampton, England. Britain goes to the polls tomorrow June 8 to vote in a general election. Getty Images UK General Election 2017 6 June 2017 A supporter wears a pair of Jeremy Corbyn decorated tights at a general election campaign event in Birmingham, central England, on June 6, 2017. Britain goes to the polls on June 8 to vote in a general election only days after another deadly terror attack in the nation's captial. AFP/Getty Images UK General Election 2017 6 June 2017 A picture taken in London, shows election leaflets from various parties displayed ahead of the United Kingdom's general elections. Britain goes to the polls on June 8 to vote in a general election only days after another terrorist attack on the nation's capital AFP/Getty Images UK General Election 2017 6 June 2017 Election workers, George Gaunt and Luca Tragid deliver the first ballot boxes, on the Royal Mile in Edinburgh AFP UK General Election 2017 6 June 2017 British Prime Minister Theresa May meets with Conservative party supporters during an election campaign visit to a bakery during an election campaign visit on June 6, 2017 in Fleetwood, north-west England. Britain goes to the polls on June 8 to vote in a general election only days after another terrorist attack on the nation's capital Getty Images UK General Election 2017 5 June 2017 British Prime Minister Theresa May speaks during a general election campaign visit to a removals depot in Edinburgh AFP/Getty Images UK General Election 2017 3 June 2017 Pro-Independence supporters hold a march through Glasgow AFP/Getty Images UK General Election 2017 3 June 2017 Opposition Labour Party leader Jeremy Corbyn campaigns for the upcoming general election in Beeston, Nottinghamshire AFP/Getty Images UK General Election 2017 3 June 2017 Labour leader Jeremy Corbyn reacts to supporters after a rally at Beeston Youth and Community Centre as he visits the East Midlands during the final weekend of the General Election campaign on June 3, 2017 in Nottingham, England. If elected in next week's general election Mr Corbyn is pledging to create a million new jobs and to scrap zero-hours contracts Getty Images UK General Election 2017 1 June 2017 Scottish Conservative and Unionist Party leader Ruth Davidson joins a selection of Scottish Conservative election candidates and activists during campaigning on May 1, 2017 in South Queensferry, Scotland. With only seven days to go until the general election on June 8th, polls are showing the SNP out in front and the Conservatives set to close in on Labour. Getty Images UK General Election 2017 29 May 2017 Prime Minister Theresa May canvasses in Richmond with Conservative candidate Zac Goldsmith on May 29, 2017 in London, United Kingdom. After suffering defeat in the London Mayoral election Zac Goldsmith resigned over the Government's position on Heathrow expansion. He stood as an Independent but lost in a by-election to the Liberal Democrats. Britain goes to the polls on June 8 to elect a new parliament in a general election Getty Images UK General Election 2017 22 May 2017 Liberal Democrat leader Tim Farron poses for a selfie taken by carer April Preston during a General Election campaign visit to the Barlow Medical Centre, in Didsbury, Manchester Yui Mok/PA UK General Election 2017 22 May 2017 Britain's Prime Minister Theresa May speaks at an election campaign event in Wrexham, Wales Reuters UK General Election 2017 22 May 2017 Britain's main opposition Labour Party leader Jeremy Corbyn, and Labour's former deputy Prime Minister, John Prescott, exit the party's general election campaign 'battle' bus as they arrive at an event in Kingston upon Hull, northern England Getty Images UK General Election 2017 22 May 2017 Britain's main opposition Labour Party leader Jeremy Corbyn walks with supporters between venues, before speaking again at another general election campaign event in Kingston upon Hull, northern England Getty Images UK General Election 2017 22 May 2017 An anti-fox hunting protester is taken away and arrested by police outside the venue where Britain's Prime Minister Theresa May was due to launch the Welsh Conservative general election manifesto at Gresford Memorial Hall in the village of Gresford, near Wrexham, North Wales, on May 22, 2017. Britain goes to the polls on June 8 to elect a new parliament in a general election AFP/Getty Images

“But what is harder for people to deal with is the fact that increasingly in this country and in my country, we are looking at oligarchic forms of government.

“I applaud Jeremy Corbyn for raising those issues because at the end of the day if we are going to create governments that work for all of us, if we’re going to deal with healthcare and create great education systems and protect the environment and combat climate change… we need to have a government of what Abraham Lincoln described as of the people, by the people and for the people, and not a government of billionaires and large, multinational corporations. So I applaud Corbyn for raising those issues.”

Mr Sanders also attacked Donald Trump’s decision to withdraw the US from the Paris Agreement on climate change.

“It was stupid and dangerous… and a setback for the entire planet,” he said.

“When Trump ran for president, he indicated his opinion that, despite all the scientific evidence, Trump understood, uniquely, that climate change was a ‘hoax’.

“It is absurd and dangerous for the president of the most powerful nation on earth to reject science.

Bernie Sanders with Cambridge Union speakers office Jonah Surkes (Cambridge Union Society) (Cambridge Union Society/Quiying Giulia Lai)

“Every public policy that is developed has to be based on science and on facts, and not on ‘alternative facts’.

“It goes without saying that Donald Trump is not one of my favourite presidents,” he quipped.

“In very strange times we have a very strange president … We have a president who lies all the time.”