WASHINGTON — One recent afternoon, Senator Bernie Sanders of Vermont gave another of the populist speeches that have drawn the largest crowds of the 2016 campaign to his rallies around the country and have made him the unexpected rival to Hillary Rodham Clinton for the Democratic presidential nomination.

The role of “super PACs” is “corrupt and amounts to legalized bribery,” he bellowed. Waving his arms, he quoted Abraham Lincoln and shared his own “vision for the future of this country.”

On the campaign trail, the speech would have elicited wild enthusiasm from his liberal supporters. But this was the Senate, which was virtually empty except for Senator Dianne Feinstein, Democrat of California, who was busy editing her own speech, and Senator Mike Lee, Republican of Utah, who was texting.

“You come here, it’s like, ‘O.K., not much response,’ ” Mr. Sanders said with some resignation in his Senate office earlier this month..

These days, Mr. Sanders, a professed socialist, does not feel rejected by his colleagues so much as baffled by a clubby institution that does not seem to understand the deep resentment about economic inequality that his campaign has tapped. “When I’m outside of here,” he said, “the ideas and the points that we are making are reverberating very strongly with the American people.”

For all his newfound attention, Mr. Sanders is still regarded by his Senate colleagues as a peripheral figure whose surging presidential campaign is more of an endearing curio than a cause for reassessment.

Senators “are kind of surprised at the phenomenon,” said Vermont’s senior senator, Patrick J. Leahy, who, like many other Democrats, is backing Mrs. Clinton. “But nobody is trash-talking Bernie.”

That is because many senators respect Mr. Sanders’s consistency and fealty to his principles, his policy fluency and his ability to work with Republicans when he was chairman of the Committee on Veterans’ Affairs to pass legislation that overhauled the veterans’ health care system.

Others, however, consider such legislation a notable exception for a compromise-allergic ideologue who has over time managed to infuriate some moderate Democratic lawmakers resentful of his self-assigned role as the Senate’s liberal conscience.

Image

Mr. Sanders is now the ranking Democrat on the Senate Budget Committee.CreditDoug Mills/The New York Times

Mr. Sanders is also not much of a favorite of Capitol Hill reporters who have grown used to his grumbling expressions of displeasure at the political nature of their questions. Asked about a gleaming “Excalibur” hanging on a wall in his office, Mr. Sanders made it clear he knows his reputation.

“That is from Ross Perot,” Mr. Sanders said. “He said: ‘When media gives you a problem, take it out! Threaten them!’ ” (It was actually a gift for his work on the veterans bill.)

Mr. Sanders’s disdain for the things he views as unimportant is matched by his single-minded focus on the things he says are of real consequence, like the future of Social Security.

At the Democratic caucus lunches, at which he is a fixture, “all he ever talks about is Social Security,” one congressional aide said. “He doesn’t even try to relate it to the topic at hand.”

That focus was on display a few weeks ago when, on an especially slow day in the Senate with only a minor vote on the schedule, caucus members piled onto buses for a White House meeting with President Obama. Looking around the room, Mr. Obama was surprised to see Mr. Sanders.

“Bernie?” he said. “Shouldn’t you be out in New Hampshire?” There was a chuckle, and then the president asked Mr. Sanders what was on his mind.

“Social Security,” Mr. Sanders said.

While Mr. Sanders takes pride in his record of providing for his home state, Mr. Leahy made it clear that when it comes to bringing money back home to Vermont, “I’m usually the one who does that.”

Mr. Sanders “is more interested in the larger macroeconomic issues,” said Eric L. Davis, a political science professor at Middlebury College in Vermont.

Asked about his legislative accomplishments over a congressional career that includes 14 years in the House and eight in the Senate, Mr. Sanders cited some amendments that passed the House, and several more recent highlights. One was getting billions of dollars of investment in energy-efficient technologies as part of the stimulus bill. Another was inserting $11 billion for community health centers in the Affordable Care Act and tripling funding for the National Health Service Corps, which forgives debts for medical students who commit to working in underserved fields and communities.

He acknowledged that he has gotten little attention for what he has done. “This is the problem,” he said. “I work in areas that nobody knows what I’m doing.”

The way he sees it, his career has not been that of a gadfly on the margins of Congress, but rather that of a moral force pulling the mainstream toward his positions.

“Stay with me on this one because this is important,” Mr. Sanders said as he sat in an armchair under Excalibur. Passing legislation is “real,” he said, but so is influencing opinion over the long term by speaking out early and often.

“I am a voice,” he said. “Everybody talks about income inequality. Well, check it out. Find out who was talking about it 20 years ago.”

With the aid of a yellow legal pad on his lap, he went through a litany of instances in which his opposition to an issue now positions him in the Democratic mainstream.

He voted against the Defense of Marriage Act (“President Clinton signed it, everyone was for it”), the deregulation of Wall Street (“Check the record! Do it. Go to YouTube, look up ‘Bernie Sanders, Alan Greenspan’ ”), the war in Iraq, the Patriot Act and welfare reform. On all the issues, he suggested, he has moved the party.

But Mr. Sanders has been more of an outlier than a leader throughout his congressional career. When he was a congressman, elected as an independent, and House Democrats decided to allow him to caucus with them to increase their depleted numbers, Representative Bill Richardson of New Mexico called him “a homeless waif” and Representative Barney Frank of Massachusetts bemoaned his “holier-than-thou attitude.”

Tom Coburn, the former Republican senator from Oklahoma, who was also a part of those budget negotiations as a member of the bipartisan Gang of Six, said that Mr. Sanders had a “my way or the highway” approach to legislating. He recalled the time he held up one of Mr. Sanders’s bills in the Senate.

“He said, ‘If you’re going to hold my bill, I’m not going to negotiate with you.’ And I said: ‘That’s fine, I’m holding your bill then. If you want to adjust your bill and meet some of our concerns, then I’ll be happy to work with you,’ ” Mr. Coburn said. “But he never once did want to do that.”

When Senator Mark Warner of Virginia, a moderate Democratic member of the Gang of Six working for the budget deal, was asked if Mr. Sanders understood the give-and-take of legislating, he smiled and said, “You always know where he stands,” before disappearing into an elevator.

“I know there are other people who are kind of resentful of that, who sit down with Republicans and make a whole lot of concessions before the debate begins,” Mr. Sanders said. “That’s not my style.”

Mr. Sanders is now the ranking member on the Senate Budget Committee, and as such would generally be expected to lead the tense and consequential budget negotiations this fall.

But according to congressional aides familiar with the Senate Democratic leadership’s thinking, they have no intention of letting someone so averse to compromise lead the talks.

Mr. Sanders disagrees. He pointed to the compromise he struck on the veterans bill in June 2014 with Senator John McCain, Republican of Arizona.

Mr. McCain compared the negotiations to an invective-strewn World Wrestling Federation match, but added: “I didn’t resent that at all. I respected it as a matter of fact because he had strongly held views.”

A year later, as a presidential candidate, Mr. Sanders has shown an ability to use the Senate as another platform for his campaign. On June 14, as senators gushed over Mrs. Clinton when she addressed the Democrats’ caucus lunch in the Capitol, he slipped out early to take advantage of the television cameras outside. And he regularly introduces legislation, and gives emphatic floor speeches, echoing his campaign message.

“He was very enthusiastic for someone speaking to an empty room,” Janet Crnich, 44, of Wisconsin, said approvingly after watching Mr. Sanders rail against the influence of money in politics from the Senate’s viewing gallery last week.

Asked in his office — a space decorated with books (“Wage Theft in America”), framed roll calls and pictures of him and President Bill Clinton — if he was a better politician than colleagues gave him credit for, Mr. Sanders put his finger to his lips.

“Shh,” he said with a smile. “Don’t give it away. You are going to ruin it for me.”