It’s the kind of deal that makes Washington’s old bulls nostalgic for days of Congress past: bipartisan, pragmatic, and swiftly pulled together behind closed doors to address an urgent policy problem.

But the bill overhauling veterans’ health care, which passed both houses unanimously this week, had an unlikely legislator at the helm: Congress’s only self-described socialist, Sen. Bernie Sanders of Vermont, who has long prided himself as being the left’s gadfly.

“When you become chairman, you can’t just say, ‘This is the way I want it.” Sen. Bernie Sanders (I-VT)

Sanders, who’s officially a political independent but votes with Democrats in the Senate, has spent far more of his career agitating from the sidelines than sitting at the negotiating table: lobbying for universal single-payer health care, blasting both parties for allowing billionaires to fund elections, and attacking President Obama for compromising on taxes with Republicans.

A co-founder of the Congressional Progressive Caucus, he prides himself on never forsaking his values and always speaking his mind—once for more than eight hours in a single stretch on the Senate floor.

But Sanders – who is almost universally known as “Bernie” – has found himself on the inside more often these days.

The bipartisan compromise that Sanders forged with Sen. John McCain, an Arizona Republican, came together with unusual speed, passing the Senate Wednesday after sailing through the House a day earlier. The scandal over wait times for veterans at VA medical facilities made made action a political imperative for Congress. But Sanders says he’s known he had to shift gears and become more open to compromise ever since he became chairman of the Senate Veterans’ Affairs Committee in 2013.

“When you become chairman, you can’t just say, ‘This is the way I want it,’” Sanders told msnbc.

It was Sanders’ first time working together with McCain, in a role that he’s rarely played before in his 23 years in Congress. As it turns out, he liked it.

“What I like about [McCain] is that he’s a no bullshit guy. He’s straightforward and he wanted to do something,” says Sanders. “I like that style of sitting down and saying, ‘I’m going to have to give, you’re going to have to give.’”

Sanders hasn’t always been as willing to make such concessions, says Alex Nicholson, legislative director for the Iraq and Afghanistan Veterans of America, an advocacy group.

“We’ve also, I think, had to push him to go outside his comfort zone in working with the minority. That’s definitely been a challenge,” Nicholson said. (Sanders says he “doesn’t recall talking about the negotiations with IAVA, which played no role in the agreement between Sens. Sanders and McCain,” according to his spokesman Michael Briggs.)

Though his group endorsed the bill at the time, Nicholson also faults the Vermont Senator for not doing more to work with Republicans on the earlier VA reform overhaul, which failed to pass in February after only two Republicans supported it.

Sanders says he’s still deeply disappointed that his original veterans’ reform overhaul failed to gain traction in the Senate. But he did make genuine concessions to Republicans in the compromise that passed Wednesday, including provisions he had criticized earlier that would allow veterans who lived more than 40 miles from VA facilities to seek private, non-VA alternatives.

It’s been a shift in tone as much as action for Sanders, the 72-year-old former Burlington mayor who became a member of the House in 1991 and the Senate in 2007. And for most of his political career, he’s been better known for exhorting Congress to act than taking action.

“He may have mellowed a bit as he’s gotten older.” ermont political scientist Eric Davis

Rising to protest President Obama’s tax compromise with Republicans in late 2010, Sanders launched into an epic speech on the Senate floor that took off on social media as the “filibernie.” It wasn’t so much a set of remarks as a great lamentation against what he described as “a war being waged by some of the wealthiest and most powerful people in this country against the working families of the United States.”

“How can I get by on one house?” Sanders continued sarcastically. “I need five houses, ten houses! I need three jet planes to take me all over the world! Sorry, American people. We’ve got the money, we’ve got the power, we’ve got the lobbyists here and on Wall Street. Tough luck. That’s the world, get used to it. Rich get richer. Middle-class shrinks.”

Compromise is easier, of course, when it comes to issues like veterans’ affairs, which have a long history of non-ideological bipartisanship. But in more recent years, Sanders has extracted a few genuine progressive victories, going beyond the purely symbolic amendments and dead-end bills that he’s accumulated over his career.

“Passing legislation has become more important for him,” says Vermont political scientist Eric Davis. “He may have mellowed a bit as he’s gotten older.”

During the fight over Obamacare, Sanders worked to include provisions to enable his home state to adopt single-payer health care, which it has now begun implementing under Democratic Gov. Peter Shumlin.

“Senator Sanders was instrumental in ensuring the waiver provision that was finalized in the [Affordable Care Act],” says Robin Lunge, the state’s director of health care. “Without that provision, it quite likely would have been pretty difficult for Vermont to do that,” she adds.

In fact, the issue is at the heart of Sanders’s vision of socialism. “What it means is that we have a lot to learn from democratic socialist governments that have existed in countries like Denmark, Sweden, Finland, Norway, where all people have health care as a right,” he told Fox News.

Sanders was also an early, vocal opponent to Chained Consumer Price Index (CPI), which would reduce Social Security benefits by tying them to a different index of inflation. The White House had originally embraced the provision when both parties were bent on achieving a deficit reduction “grand bargain.” Calling such reforms “morally grotesque,” Sanders led protests against entitlement cuts, giving one speech while a security officer shooed activists off the steps behind him.

Sanders lobbied inside Capitol Hill as well, banding together with like-minded liberals like Sens. Sheldon Whitehouse of Rhode Island and Sherrod Brown of Ohio to oppose the entitlement cuts.

“He has led the opposition to the use of so-called chained CPI as part of any budget deal from the beginning and has kept up the drum beat since then,” says Jim Manley, a former spokesman for Senate Majority Leader Harry Reid.

Then in February, President Obama took chained CPI out of his proposed budget. It was already clear at that point that a sweeping deficit-reduction deal on taxes and entitlements was kaput—making Obama’s concession a moot point— but Sanders and his cohort declared victory anyway.

“We put together a strong coalition,” Sanders says. Now the debate within the Democratic Party “is not about cutting Social Security, but about expanding Social Security,” he adds.

Sanders certainly has more company these days. In a more polarized Senate, he’s now joined by unapologetic liberals like Massachusetts Sen. Elizabeth Warren, who in many ways has eclipsed Sanders as the left’s progressive hero when Democrats turned her own populist crusade into reality. Thomas Piketty’s tome on inequality is now an Amazon bestseller. And with Congress gridlocked, the Democratic Party has felt freer to embrace the ideals of economic populism more fully – precisely because Congress isn’t anywhere close to making most of it a legislative reality.

But Sanders says his views were never on the fringe. “Virtually all ideas I bring forth—the ideas may not be supported today in Congress, but they are supported by the American people,” he says.

His righteous convictions have also led him to contemplate a run in for president in 2016. “The working class and middle class need candidates to work for them. Within that context, I am giving consideration to running,” he says. Unlike Warren, he’s vocal about his desire to run—and about Hillary Clinton’s shortcomings.

The more pressing question is whether Sanders can continue to be an effective policymaker without a crisis forcing Congress to act – or whether there will be just more replays of February’s failed overhaul. “We have other stuff to get to,” explains Nicholson from the veterans’ advocacy group. “Our big issue is suicide prevention.”

Sanders insists that he’s game for future compromises.

“I think that’s what the American people want—they want people of good faith to come together, and McCain was operating in good faith,” he says. “I hope this becomes an example.”