At Tuesday night’s Democratic presidential debate, the audience booed Sen. Bernie Sanders after a rival noted his vote for a 2005 bill that shielded gun manufacturers and dealers from being held liable for crimes committed with weapons they made and sold.

Sanders launched into a full-throated response to the attack, acknowledging he had cast a “bad vote,” but disputing the idea that he had been soft on gun issues and had opened the door for high-powered weapons to be used in mass shootings.

"Because of all these disgusting and horrific mass shootings, the American people now understand that we must be aggressive on gun safety, not be dictated to, by the NRA," Sanders said. "I am proud that I have a D-minus voting record from the NRA -- if elected president, it will get worse than that."

The issue has the potential to dog the Democratic front-runner, who has spent a career navigating a nuanced course on gun control measures popular with many primary voters, but less appealing to his constituents in rural Vermont.

In a 1991 letter he wrote to a gun shop owner in Burlington, obtained by ABC News and not previously reported, Sanders put his mixed feelings about gun control measures into words. Over the course of the letter, Sanders writes that he is against a “one-size-fits-all policy,” that he “opposed the ‘Brady Bill … [and] the seven-day waiting period.” He writes that he would “support an assault weapons ban” so long as it did not permit Treasury Department officials to add additional models of weapons to the ban and providing the ban expired in three years.

He concludes by writing that he would ultimately be voting against the ban -- because it was part of a larger crime bill, which had other provisions he did not like.

The letter lays out an approach that has sent mixed signals to voters who are trying to evaluate his stance. While he has, as he said in the debate, amassed a record disliked by the National Rifle Association, he has not always voted in step with those advocating gun control, including the 2005 vote backing legislation that shielded gun manufacturers from lawsuits filed by victims of gun crime. And he has, over decades, remained largely silent about the presence just north of Burlington of one of the nation’s largest manufacturers of military-style assault rifles – which made the weapons used in two mass shootings last summer.

One of his rare public statements about the factory came in 2012, after the Sandy Hook school shooting, in which Sanders appeared to defend the Century Arms factory. The statement -- issued with two other Vermont lawmakers -- came after critics raised questions about the manufacturer.

“They [Century Arms] are engaged in a lawful business just as other are that are involved in firearms commerce, employing many Vermonters,” the statement read. “And if Congress approves new steps to address gun violence, we are confident that Vermont businesses would comply with them.”

Sanders' record on guns

When Elizabeth Deutsche, a nurse and community advocate, went to the state capitol to urge the state legislature to pass gun control legislation, she appeared at the same witness table as Henry Parro, a gun shop owner who was there advocating for votes against the bill in 2018.

Deutsche and Parro couldn’t be farther apart in their views on how gun control ought to be legislated, but they do seem to agree on one thing: Sanders.

They both believe Sanders has crafted his stance on gun issues based on political winds, not passion.

Parro said Sanders has ditched pro-gun rights positions that were popular with many Vermont voters, and adopted a more strident gun control stance to suit his bid for president – and satisfy a more liberal national primary audience.

“I think he is giving lip service to the Democratic party,” Parro said. “Some of his voting record shows it goes completely against, if you go back to the beginning, his core values.”

Deutsche sees those past conservative votes that Parro liked as troubling. It’s a record that make it hard for her to see him as a reliable advocate going forward.

“Senator Sanders uses our rural state with a large number of sportsman and hunters to justify his previous weak stance on gun control," Deutsche said. "As a gun owner, I can't stand behind that and I don't accept his justification for that."

Parro’s gun shop in Waterbury, Vermont, sells hunting and defense firearms, as well as military-style AR-15 rifles produced by Century Arms. He still remembers a different kind of relationship between Sanders and guns. It’s a relationship that Parro says once won Sanders the favor of the NRA helped get the once little-known political hopeful elect.

Sanders lost his first bid for the House of Representatives to Republican Peter Smith after campaigning in favor of an assault weapons ban in 1988, which he highlighted during Tuesday night's debate.

"Thirty years ago, I likely lost a race for the one seat for Congress in Vermont because 30 years ago,I supported a ban on assault weapons," Sanders said. "Thirty years ago," he repeated.

But after Smith voted in favor of an assault weapons ban on the Hill, the NRA ran ads targeting Smith’s re-election bid in 1990. Though the NRA didn’t endorse Sanders for the House seat, and the earliest rating he received from the NRA came two years later -- a "D" -- he did benefit from the NRA’s attacks on his opponent.

"We don't like everything that Mr. Sanders has to say about firearms," James Baker, an NRA lobbyist, told a local newspaper in 1990. "But he's been up front about it. He's at least as good, if not better, than Mr. Smith."

Sanders unseated Smith that year. He held that seat until 2006, when he was elected to the Senate where he’s served ever since.

During his early years on Capitol Hill, Sanders held some positions welcomed by gun control advocates. He campaigned in favor an assault weapons ban, and since the mid-1990s, Sanders has voted for several bills that would ban semi-automatic weapons.

But when Congress was debating the Brady Bill requiring a mandatory five-day waiting period for those wishing to purchase handguns, Sanders voted no.

Multiple versions were proposed during the two-year battle to get it passed, and Sanders voted against almost every one, including the one signed into law. Sanders did vote in favor of an amendment that would remove the waiting period and allow for an instant background check, but the technology to perform instant checks did not exist at the time.

In the letter Sanders wrote to the concerned constituent, he explained he voted against the bill because it contradicted his "basic philosophy" that "whenever possible, this issue should be dealt with at the local or state level."

"In most instances, there is not a 'one-size-fits-all' policy that would be appropriate for the entire nation," Sanders explained.

As he wrote in the 1991 letter, Sanders expressed his desire to support an assault weapons bill, but stated he would be unable to do so if it were introduced as part of other legislation he disagreed with. He said he viewed the larger legislation, including the Brady Bill, as something that "would further limit the right of the citizens of our nation" as it would "'federalize' certain crimes that have previously been under the jurisdiction of the states."

Sanders highlighted what he said was his "basic philosophy" that "whenever possible, this issue should be dealt with at the local or state level."

When asked if Sanders' record on gun control is a source of worry, his campaign pointed to a number of endorsements from gun control activists, such as Delaney Tarr, the co-founder of March for Our Lives.

James Haslam, who serves as the Executive Director of Rights and Democracy Vermont, a liberal advocacy organization, said Sanders' position on guns in his early career made political sense. His constituents supported many progressive ideas but felt that the government should “lay off our guns,” Haslam said.

“He is obviously trying to unite communities in a state that didn’t see gun violence as a big problem and that cares deeply about freedoms,” Haslam explained. “So as a representative, he laid off.”

Sanders maintained that posture when he voted in favor of a 2005 law that shielded gun manufacturers and distributors from liability if they sold a weapon used to commit a crime.

The bill’s 65-31 passage in the Senate was a hard-fought victory for the NRA and its lobbyists. Fourteen Democrats and the Independent Sanders, along with the bulk of the Republican majority, helped turn the bill into law.

This 2005 bill has come up again and again in the wake of mass shootings. A judge used it to overrule a lawsuit brought by the parents of the victims in the Aurora, Colorado, shooting. And though the case was ultimately allowed to continue, parents of students at Sandy Hook Elementary faced a similar battle in bringing a different lawsuit.

In the years since the legislation’s passing, Sanders has said he would reconsider the law. But he’s never gone so far as to call for its repeal.

“There are parts of it that made sense to me,” Sanders told ABC News in 2016. “If you have a small gun shop owner in Northern Vermont who sells a gun legally to somebody and then, you know, something happens to that guy, he goes nuts or something, and he kills somebody, should the gun shop owner be held liable? I think not.”

This year, on the debate stage, Sanders offered a much stronger view.

“Right now, my view is we need to expand background checks, end the gun show loophole, and do what the American people want, not what the NRA. wants,” Sanders said during the debate Tuesday night.

To Parro, statements like this read like a betrayal.

“He’s abandoned his core beliefs, he’s jumped on the band-wagon to say whatever he needs to say to get elected,” Parro said.

Century Arms

A Century Arms MSR-15 is in the center display on a wall of semi-automatic weapons at Parro’s gun shop. It’s likely that weapon traveled less than 35 miles from the nearby Century Arms factory to the walls of Parro’s shop-- a short journey during which the guns would certainly have been driven past pro-Sanders signs posted all over his home base in Burlington.

Despite the proximity of the factory to Bernie’s hometown, the senator has said almost nothing about the facility despite his aggressive campaigning for gun legislation reform. Though Century Arms is just 40 minutes north of Burlington, where Sanders once served as mayor, locals say they don’t see him around their part of the state very much. The public record also shows little contact between Sanders and the manufacturing plant.

The Century Arms facility sits at the end of a winding road inside of a large industrial park about 30 minutes outside of Burlington. The facility is largely unmarked, save a flag that bears the Century Arms logo, which flies next to a U.S. flag and a flag for the state of Vermont. The whole manufacturing plant is surrounded by a metal chain link fence, and employees park in a lot within the fence. The single-level facility is a hub of activity, with loading docks for trucks lining the walls. Employees can be seen walking around the plant and trucks come and go, with boxes being loaded on and off with deliveries

It’s one of the largest employers in Vermont, a factor some local politicians say has made the state reluctant to propose regulations that could curtail employment opportunities.

ABC News attempted to speak with representatives for Century Arms on multiple occasions over the phone, by email and in person. The company, which industry professionals say is known to avoid news media attention, could not be reached for comment.

Since the 1960s, Century Arms has been producing guns in Vermont. Today, it is one of the largest manufacturers of firearms in the nation. In 2017, the Bureau of Alcohol, Tobacco and Firearms reported that Century Arms produced 45,372 firearms in its Vermont facility.

This summer, when mass shootings in Gilroy, California, and El Paso, Texas, killed 25 people, one common thread between the two shootings was the gun used by the killers. Both wielded weapons made by Century Arms, law enforcement officials told ABC News.

When Sanders appeared on MSNBC to talk about the shootings, he blamed the NRA.

"We have got to ask how it happens that a time when so many people want to go forward with gun safety legislation that we have a Senate that is refusing to deal with a bill that was passed in the House," Sanders said. "And that again goes back to the NRA."

Sanders made no mention of Century Arms.