Bernie Sanders was elected to the House in 1990 after branding himself an outsider and defying calls to join a Democratic Party he had long bashed as “ideologically bankrupt.”

Nonetheless, Mr Sanders, a democratic socialist who won Vermont’s lone House seat as an independent, quickly sank into a funk when Democratic conservatives circulated a list of nasty things he had said about them over the years — ostracising him from their caucus and blocking his committee assignments for a few nerve-frazzling days.

“That was emotionally very difficult — it was a very, very difficult period,” Mr Sanders, who is not known for his sentimentality, said in a recent interview. “I’ll never forget it. You come into the House, you expect to come to work, and you find that the majority leadership doesn’t know where they are going to sit you — if they are going to sit you.”

He marked the moment, in an I-will-never-go-hungry-again kind of way. As time and circumstance changed, Mr Sanders gradually evolved from a marginalized gadfly in the House to a reliable Democratic vote in the most insider-y club in Washington, the US Senate.

The change says much about the power of a senator compared with that of a congressman, but even more about the deep pragmatism of Mr Sanders’ do-it-yourself political career, a quality that has propelled him to the top tier of the Democratic presidential field for 2020.

The Democrat challengers to Trump in 2020 Show all 25 1 /25 The Democrat challengers to Trump in 2020 The Democrat challengers to Trump in 2020 Bernie Sanders The Vermont senator has launched a second bid for president after losing out to Hilary Clinton in the 2016 Democratic primaries. He is running on a similar platform of democratic socialist reform Getty The Democrat challengers to Trump in 2020 Joe Biden The former vice president recently faced scrutiny for inappropriate touching of women, but was thought to deal with the criticism well and has since maintained a front runner status in national polling EPA The Democrat challengers to Trump in 2020 Elizabeth Warren The Massachusetts senator is a progressive Democrat, and a major supporter of regulating Wall Street Reuters The Democrat challengers to Trump in 2020 Amy Klobuchar Klobuchar is a Minnesota senator who earned praise for her contribution to the Brett Kavanaugh hearings Getty The Democrat challengers to Trump in 2020 Michael Bloomberg Michael Bloomberg, a late addition to the 2020 race, announced his candidacy after months of speculation in November. He has launched a massive ad-buying campaign and issued an apology for the controversial "stop and frisk" programme that adversely impacted minority communities in New York City when he was mayor Getty Images The Democrat challengers to Trump in 2020 Tulsi Gabbard The Hawaii congresswoman announced her candidacy in January, but has faced tough questions on her past comments on LGBT+ rights and her stance on Syrian President Bashar al-Assad Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Pete Buttigieg The centrist Indiana mayor and war veteran would be the first openly LGBT+ president in American history Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Deval Patrick The former Massachusetts governor launched a late 2020 candidacy and received very little reception. With just a few short months until the first voters flock to the polls, the former governor is running as a centrist and believes he can unite the party's various voting blocs AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Beto O'Rourke The former Texas congressman formally launched his bid for the presidency in March. He ran on a progressive platform, stating that the US is driven by "gross differences in opportunity and outcome" AP The Democrat challengers to Trump in 2020 DROPPED OUT: Kamala Harris The former California attorney general was introduced to the national stage during Jeff Sessions’ testimony. She has endorsed Medicare-for-all and proposed a major tax-credit for the middle class AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Bill De Blasio The New York mayor announced his bid on 16 May 2019. He emerged in 2013 as a leading voice in the left wing of his party but struggled to build a national profile and has suffered a number of political setbacks in his time as mayor AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Steve Bullock The Montana governor announced his bid on 14 May. He stated "We need to defeat Donald Trump in 2020 and defeat the corrupt system that lets campaign money drown out the people's voice, so we can finally make good on the promise of a fair shot for everyone." He also highlighted the fact that he won the governor's seat in a red [Republican] state Reuters The Democrat challengers to Trump in 2020 DROPPED OUT: Cory Booker The New Jersey Senator has focused on restoring kindness and civility in American politics throughout his campaign, though he has failed to secure the same level of support and fundraising as several other senators running for the White House in 2020 Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Wayne Messam Mayor of the city of Miramar in the Miami metropolitan area, Wayne Messam said he intended to run on a progressive platform against the "broken" federal government. He favours gun regulations and was a signatory to a letter from some 400 mayors condemning President Trump's withdrawal from the Paris Climate Accord Vice News The Democrat challengers to Trump in 2020 DROPPED OUT: Kirsten Gillibrand The New York Senator formally announced her presidential bid in January, saying that “healthcare should be a right, not a privilege” Getty The Democrat challengers to Trump in 2020 DROPPED OUT: John Delaney The Maryland congressman was the first to launch his bid for presidency, making the announcement in 2017 AP The Democrat challengers to Trump in 2020 DROPPED OUT: Andrew Yang The entrepreneur announced his presidential candidacy by pledging that he would introduce a universal basic income of $1,000 a month to every American over the age of 18 Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Julian Castro The former San Antonio mayor announced his candidacy in January and said that his running has a “special meaning” for the Latino community in the US Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Marianne Williamson The author and spiritual adviser has announced her intention to run for president. She had previously run for congress as an independent in 2014 but was unsuccessful Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Eric Swalwell One of the younger candidates, Swalwell has served on multiple committees in the House of Representatives. He intended to make gun control central to his campaign but dropped out after his team said it was clear there was no path to victory Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Seth Moulton A Massachusetts congressman, Moulton is a former US soldier who is best known for trying to stop Nancy Pelosi from becoming speaker of the house. He dropped out of the race after not polling well in key states Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Jay Inslee Inslee has been governor of Washington since 2013. His bid was centred around climate change AFP/Getty The Democrat challengers to Trump in 2020 DROPPED OUT: John Hickenlooper The former governor of Colorado aimed to sell himself as an effective leader who was open to compromise, but failed to make a splash on the national stage Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Tim Ryan Ohio representative Tim Ryan ran on a campaign that hinged on his working class roots, though his messaging did not appear to resonate with voters Getty The Democrat challengers to Trump in 2020 DROPPED OUT: Tom Steyer Democratic presidential hopeful billionaire and philanthropist Tom Steyer is a longtime Democratic donor AFP/Getty

Bernie Sanders, in effect, cut a bargain, eschewing the role of in-house rebel for the freedom to create and nurture his brand as the outsider, ever scornful of half-loaf compromise.

“Nobody walks the line between insider and outsider better than Bernie — nobody,” said Virginia's Democratic Senator Tim Kaine, who was Hillary Clinton’s running mate in 2016.

Indeed, Mr Sanders, though still a registered independent, is increasingly emphasising his hidden life as a get-along “Democrat” in an attempt to broaden his appeal and woo away voters who might otherwise reject his brand of insurgent politics for more mainstream candidates, like former Vice President Joe Biden and Senator Kamala Harris of California.

“He’s a Democrat,” said his campaign manager, Faiz Shakir.

During his 12 years in the Senate, Mr Sanders, 77, has voted in favour of virtually every major piece of legislation, procedural motion or budget compromise pitched by his leaders — especially when his no vote would have affected the outcome.

In the process, he has forged surprisingly close ties with Harry Reid, the wily former majority leader from Nevada, and Reid’s successor as Democratic leader, Chuck Schumer of New York.

In turn, those senators have given him a platform from which to launch his big progressive policy agenda, including Medicare for all and free college tuition.

(AP (AP)

The Sanders two-step — voting with leadership, but unhappily — not only reflects his innate, if tempered, disdain for the establishment but also allows him to play the maverick even as he’s playing nice.

One Democratic senator, who likes Mr Sanders, half joked that it was politically “important” for him to appear ticked off “at all times.” Mr Sanders did not dispute the general point.

A big part of Mr Sanders’ compliance stems from something he has seldom declared in his speeches: personal loyalty to Reid. In contrast to the hostility in the House, Reid welcomed the independent enthusiastically to his conference in 2006.

Their relationship faced a test in late 2009, when Reid summoned him to his office to nail down support for the Affordable Care Act, even though Mr Sanders viewed it as a “pathetic” substitute for the federally funded single-payer system he had long championed — and some Mr Sanders supporters were pushing him to oppose the bill.

“I’m not happy, Harry!” Sanders said shortly after sitting down in the leader’s office, according to people familiar with the exchange. “But I’m voting yes. So you don’t have to worry about me.”

A handful of conservative Democrats played hardball, but Sanders did not. He made two requests after pledging his loyalty: funding for community health centres, and a floor vote for a federally funded single-payer system, the basis for his current Medicare-for-all proposal.

He got the money, and Mr Reid reluctantly agreed to schedule the vote; Mr Sanders later withdrew the single-payer vote in the interest of speeding up passage of the bill, at Mr Reid’s request.

“When you have a relationship with the US Senate leader, who you consider a friend, you cannot blackmail him,” Mr Sanders said. “It’s a two-way street. When I need help — and I think I wasn’t overly aggressive in demanding help on every bill, as some people do — Harry was there for me, and when he needed my support, I was there for him.”

In 2017, Mr Sanders repeated the favour. Republicans in the majority tried to bring his Medicare-for-all proposal to the floor, in hopes of forcing endangered moderate Democratic incumbents into a party-splintering vote.

Mr Schumer persuaded a yet again disappointed Mr Sanders to urge all Democrats, especially influencers weighing 2020 presidential bids, to vote “present,” rather than yes or no, to short-circuit the sabotage attempt.

Bernie Sanders posts edited video of himself 'scaring' Trump on his Instagram

But accommodation is not the same as accomplishment. Mr Sanders’ record of legislative achievement has been slender and sporadic, with two notable exceptions: the passage of a bipartisan veterans health bill in 2014 and his success inserting $11bn for community health centre into the Obamacare bill a decade ago.

“He introduces about 25 bills of substance a year,” said Craig Volden, a University of Virginia professor who runs a project rating the effectiveness of legislators, adding, “He has kind of a low batting average.”

Mr Volden’s system rated Mr Sanders as “below expectations” for much of his tenure in the Senate, based on bills passed or considered by committees.

That is the lowest rating of any of the seven senators seeking the presidency, far behind the leader of the pack among 2020 Democrats, the bipartisan deal-cutter Amy Klobuchar of Minnesota — and a few notches lower than Mr Sanders’ main competitor on the left, Elizabeth Warren of Massachusetts.

His work as ranking member of the Senate Budget Committee has been mixed. Mr Sanders has had trouble recruiting and retaining first-class staff for the committee and has often called on Washington's Democratic Senator Patty Murray, a highly regarded legislative technician who served as committee chair, to lend the expertise of her aides on complex budget matters, according to three Democratic senators and two aides who spoke on the condition of anonymity.

Mr Sanders bridles at boring technocratic toil and once impatiently asked an aide, “What’s the news for today?” during a discussion of ho-hum committee business, one former staff member recalled.

Mr Sanders said his main goal had always been to move the Democratic Party to the left, rather than work within the system to hammer out compromise measures. And he has had an impact on select issues, pushing the leadership of both parties to challenge President Donald Trump on his support of Saudi intervention in Yemen.

When asked for his most significant legislative accomplishment in the past year, he pointed to bills that would pressure large employers like Amazon, Disney and Walmart to improve their pay and benefits.

That measure is unlikely to see the floor, he conceded, but the “point of the legislation was to tell Amazon, to tell Disney, we are going to stand with workers — you can have significant success without ever passing a piece of legislation.”

Despite wearing his curmudgeon’s attitude with pride, Mr Sanders has gone out of his way to maintain a positive working relationship with Warren, huddling with her in a Senate hallway recently to smooth over a fracas between the campaigns on Twitter.

Democratic debate: Bernie Sanders says a 'socialist' can defeat 'pathological liar' Donald Trump: 'We're ten points up'

He worked closely with John McCain, on a major bipartisan veterans health care reform bill in 2014. Later, he asked McCain if he could use his image during the presidential campaign, to push back on Ms Clinton’s claim that his legislative record was all “pie in the sky” with no real accomplishment. McCain was tickled and quickly said yes.

Mr Sanders can often be less than attentive to the small but significant personal interactions that foster deep loyalty to him. Senator Jeff Merkley of Oregon, the only Democrat in the upper chamber to back Mr Sanders’ challenge to Ms Clinton in 2016, has yet to endorse him in the 2020 race. In fact, Sanders has not even reached out to formally request Merkley’s endorsement a second time, an omission one person close to Merkley viewed as a blunder.

And even Patrick Leahy of Vermont, the one Senate Democrat so far to endorse him for 2020, has not entirely forgotten the irritation Mr Sanders has brought him over the years. There was that time in 1974 when Mr Sanders’ third-party challenge nearly cost him his first election to the Senate.

“I was running to become the first Democratic senator in the history of Vermont,” Leahy recalled in an interview. “Bernie knew that 95 per cent of the votes he got would come from me and not the Republican, but he ran anyway.”

Then Mr Leahy paused.

“But, you know, he’s a likable guy.”