When he steps on the stage for the first Democratic presidential debate on Tuesday in Las Vegas, Bernie Sanders will be a changed candidate from when he started his insurgent run back in April. The Vermont senator has shifted his positions and tone over the last several months, moving to the left on gun control, race and other issues, aligning more closely with the Democratic base and making himself more palatable to the party as its potential presidential nominee.

The conventional wisdom of the Democratic race holds that Sanders is the principled liberal challenging Hillary Clinton, who has flip-flopped on a number of issues in her political career. At the start of the campaign, Sanders was to the left of Clinton on economic issues, but the former secretary of state had been more vocal on other progressive concerns, such as tensions between minorities and the police.

Clinton has moved towards Sanders-like stances on economic issues, such as when she announced her opposition to the Trans-Pacific Partnership last week. But Sanders has moved too. The Vermont senator, who voted against the 1993 Brady Bill that mandated background checks for most gun purchases and in 2005 supported a provision that shielded gun manufacturers and dealers from lawsuits for crimes committed with the guns they supplied, is now emphasizing his support for expanded background checks, a ban on assault weapons and other gun control provisions.

Sanders, who has not been a leader on civil rights issues in Congress and at times suggested the root of racial problems was largely economics, has now wholeheartedly embraced the language and policy positions of the “Black Lives Matter” movement. He recently introduced a bill in Congress that would bar the federal government from putting convicts in privately-operated prisons, as civil rights advocates argue profit-making from incarceration creates incentives to jail more Americans.

The senator, who opposed a 2007 immigration bill that created a pathway to citizenship for undocumented immigrants, is now a strong supporter of so-called comprehensive immigration reform. Clinton, then a senator, backed the 2007 provision, which Sanders said would bring too many workers from abroad to the U.S. and potentially depress wages.

He voted for a similar bill in 2013.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

“I plead guilty-I should have been more sensitive at the beginning of this campaign to talk about this issue,” Sanders told The New Yorker last week, referring to tensions between minority groups and the police.

In a recent interview with MSNBC’s Chris Hayes, Sanders bragged about his D- rating from the National Rifle Association, saying “we need strong gun control.” On Sunday, the Vermont senator rejected the idea that he favors "moderation" on gun control.

"I wouldn't use the word, 'moderation," Sanders said on NBC's "Meet the Press."That's not quite the right word. This is what I do believe. I come from a state that has virtually no gun control. And yet, at political peril, I voted for an instant background check, which I want to see strengthened and expanded. I voted to ban certain types of assault weapons which are designed only to kill people.I voted to end the so-called gun show loophole."

On all of these policies, Sanders is moving closer to key blocs of the Democratic base: blacks, Latinos, and gun control advocates.

Sanders re-framing of these positions is part of a broader shift for the self-described “democratic socialist” from a man running a protest campaign against the seemingly inevitable Clinton to a person who leads polls in New Hampshire and has become a serious rival to the former secretary of state.

Sanders and his team is hiring organizers in states like South Carolina that are heavily African-American, trying to reduce Clinton’s huge lead among minority voters. As first reported by the New York Times, Sanders, who is averse to using polling, is now considering such research to figure out how he can best connect with black and Hispanic voters. He hired a Latino outreach director earlier this month.

And his campaign is specifically highlighting polls conducted by media organizations that show the senator leading potential match-ups against Jeb Bush and other Republicans, trying to reverse the perception Sanders is a liberal gadfly who would be easily defeated in a general election.

“Our campaign is the best suited to beat Republicans in key states in a general election,” Sanders said in a Twitter message last week.

The former secretary of state seems now to realize that socialists in her rear-view mirror are closer than they once appeared. Over the last week, while not attacking Sanders by name, Clinton started to contrast his positions with hers. Clinton is noting that she does not support free college for “Donald Trump’s kids.”

Sanders wants to make public colleges tuition-free for all Americans, while Clinton is proposing to allow students to go debt-free with a more complicated plan that is means-tested, so the wealthy would get few benefits.

Clinton also blasted the provision that makes it harder to file lawsuits against gun manufacturers, making another unsubtle contrast with Sanders.

“One of the most egregious, wrong pieces of legislation that ever passed the Congress when it comes to this issue is to protect gun sellers and gun makers from liability,” Clinton told a crowd at an event in Mount Vernon, Iowa. “They are the only business in America that is wholly protected from any kind of liability. They can sell a gun to somebody they know they shouldn't and they won't be sued.”

Clinton is expected to highlight Sanders’ previous conservative votes on gun control at the Las Vegas debate, with renewed attention on the issue in the wake of a mass shooting at a community college in Oregon. But Sanders may have blunted much of her attack by adopting a gun-control stance approach that closely mirrors that of the former first lady, who also wants to limit assault weapons and expand background checks.

“Secretary Clinton and Sen. Sanders both support taking action to try to prevent these atrocities from happening in the future,” said Jeff Weaver, his campaign manager.

NBC's Alex Jaffe and MSNBC's Alex Seitz-Wald contributed to this report.