An outsider born in New York City, Sanders was facing a popular five-term incumbent. He had already failed twice in bids for the U.S. Senate (1972 and 1974) and twice more as a candidate for governor (1972 and 1976). His brand of socialism was not faring too well in Vermont, where many voters leaned populist but were decidedly blue-collar on social issues such as guns, crime, and policing.

They may have agreed with him on jobs, but they were not likely to tolerate his apparently critical view of law enforcement — like the time he walked around Chicago posting fliers denouncing police brutality while a cop trailed behind him, taking them down.

So Sanders changed his tune on the police.

"Bernie took the approach that cops were 'labor,' not the enemy, their demands should be listened to, and they deserved higher pay," says Huck Gutman, his former chief of staff and longtime friend. "He promised to open negotiations with them and generally to keep coming back around to income and the economy.”

For reframing the issue, Sanders was rewarded. In a turn of events that "surprised everyone," Gutman says, the Burlington Patrolmen's Association decided to endorse him — the leftist, anti-Vietnam War agitator — rather than the incumbent, whom it had endorsed in the past. Even the police commissioner, Tony Pomerleau, a wealthy, conservative Republican who had frequently sparred with Sanders over the development of Burlington’s waterfront, was impressed and became an ally.

With their help, Sanders went on to win that election by 10 votes. Then he won 13 more races, serving as mayor for eight years and as a member of Congress for well over two decades and counting.

Throughout, he apparently never forgot the lesson of his first winning campaign: In a state like Vermont, when it comes to criminal justice, change the subject to economics.

“You talk about criminal justice, and Bernie Sanders is not the name you would think of," says Virginia Sloan, founder and president of the Constitution Project and former counsel to the House Judiciary Committee, when Sanders was a representative. "He voted reliably [with other liberals] on those issues, but he wasn’t out front on crime and the police and prisons, because his focus was always economic inequality.”

Sanders's voting record has indeed been consistent. He was one of the few white members of Congress to vote against ending Pell grants for prisoners, and he forcefully spoke out against President Bill Clinton's 1994 Crime Bill before voting with most Democrats in favor of the final version, because it included the Violence Against Women Act. More recently, he has supported the Smarter Sentencing Act and the Second Chance Act, which would reduce prison sentences for low-level offenders and help them re-enter society, respectively.

Sanders says his focus on economic issues is absolutely consistent with a commitment to a fair criminal-justice system. “As a nation, we must do everything we can to make sure that people do not end up in jail,” he told The Marshall Project in a statement. Therefore, “we should be investing in jobs and education, not jails and incarceration.”

But Sanders “has never taken direct action on criminal justice that I know of, and I haven’t heard anything from him about dealing with it here in our home state,” says Suzi Wizowaty, the executive director of Vermonters for Criminal Justice Reform.

He has also taken mostly pro-gun, pro-police stances throughout his career, natural for a Vermonter but surprising to those who see him as a predictable lefty. “I think that urban America has got to respect what rural America is about,” he told NPR this year, in a typical exchange over guns.

Even as a wave of police-involved shootings have seared race and police reform into the 2016 contest, Sanders has until very recently declined to focus on police and criminal-justice issues, instead offering his usual focus on economic inequality as the "root cause" of crime. Ininterviewsandstatementsfollowingthe events in Ferguson, Mo., he repeatedly invoked his tenure as mayor of Burlington, suggesting that he knew first-hand that policing was a tough job. He then offered general support for "community policing" and "de-militarization of the police" before quickly tacking to statistics on unemployment.

But Sanders’s "it's the economy, stupid" approach to criminal justice may not be salient nationally, in 2015, the way it was among white Vermonters three decades ago. Reforming police and prisons has become a winning issue, not only among Democrats but also some economically conservative Republicans.

His main rival in the Democratic primary, Hillary Clinton, has herself taken to talking about “mass incarceration” in more explicit terms than she ever has.

In early August, a Sanders event was very publicly interrupted by Black Lives Matter activists demanding that he address race, police violence, and mass incarceration in more explicit terms.

Meanwhile, the large crowds and surging poll numbers Sanders had enjoyed in overwhelmingly white states such as Iowa and New Hampshire gave way to half-empty gymnasiums at historically black colleges in South Carolina. His favorite topics, extolling the virtues of (mostly white) Scandinavian economies and of the New Deal, were not assuaging the concerns of voters who believed that their bodies, not just their wallets, were under assault from the criminal justice system.

Sanders, who is known for being so consistent that his remarks from 1989 are almost interchangeable with his statements today, has accordingly begun to shift course on criminal justice for what is now the second time in his career.

He now speaks of the "four types of violence waged against black and brown Americans" — not only the economic, but also the physical, political, and legal. In late August and early September, he actively consulted with stakeholders in criminal justice reform, trying to learn as much as he could. He “asked us questions like, 'How are private prisons defined?'; 'What's a halfway house?'; and 'Tell us how to lower rates on phone calls to inmates,'" says Alex Friedmann, the managing editor of Prison Legal News and associate director of the Human Rights Defense Center, and one of the experts consulted.

Sanders learned that his own state has a special relationship with private prisons.

Vermont is one of only five states that ships prisoners to private prisons in other states, because its own facilities do not have the capacity. The process yields great profits to companies like Corrections Corporation of America (CCA) and The GEO Group, while burdening families with the costs: making long-distance calls, traveling long distances to visit loved ones.

"Bernie must have known about this, because Vermont is a tiny state and representatives have a lot of contact with voters, and many of them are really upset about the out-of-state transfers," says Holly Kirby of Grassroots Leadership, an organization that advocates holding prisoners nearer to home. (Kirby is one of the activists Sanders's advisers have consulted over the past few weeks.) "But when these out-of-state transfers came up and we asked him to take a stance," she says, "they seemed like they hadn't heard about it and said they'd get back to me."

Sanders's month of study has culminated in a piece of legislation, just introduced, that would abolish private prisons for federal prisoners and encourage states to do the same. To deal with the potential overflow of federal prisoners, the bill would also reinstate the federal parole system, which was discontinued by Congress in 1984.

To Friedmann and Kirby, the legislation is a needed addition to the conversation on criminal justice, because it addresses the privatization of prisons — a Bernie Sanders-style economic issue *within *criminal justice. Others in Congress, they say, have focused too narrowly on issues like mandatory minimums and sentencing.

But Friedmann says the final draft of the bill also reveals Sanders's inexperience on criminal justice, and his haste to right himself on the subject. "It appears to be more for political purposes than to actually address the many problems in our criminal justice system," says Friedmann. “The bill only suggests — with no enforcement mechanism — that states abolish private prisons. It [also] shows a lack of understanding about the parole system, which many now see as a way of ‘catching’ ex-offenders on technical violations, rather than helping them re-enter society.”

Another reason Sanders has not needed to focus on criminal justice until recently is that his fellow senator from Vermont, Patrick Leahy, is passionate about the subject. A former prosecutor and long the ranking member on the Senate Judiciary Committee, Leahy, a Democrat, has provided cover to Sanders on criminal justice and the law.

“Within the Vermont delegation,” says David Carle, a spokesperson for Leahy, “the senators have an informal practice of not being on the same committees and not focusing on the same issues. The fact that social issues, civil rights aren’t Bernie’s favorite portfolio is partly by design. It’s so that we can spread our state’s influence.”

Matthew Valerio, Vermont’s Defender General, says that for 15 years he has worked closely with both Leahy and Burlington’s representative in the House, Peter Welch, often meeting with them in their Washington offices to discuss justice system funding.

“But I’ve known Bernie since he was mayor of Burlington,” says Valerio, “and he has never once spoken to me about criminal justice.”

An earlier version of this article incompletely described Senator Sanders's position on the 1994 Crime Bill. Although he initially spoke out against it, he voted for the final version.