Democratic presidential candidate Bernie Sanders spoke to a crowd against a Rocky Mountain backdrop at the University of Colorado in Boulder Oct. 10, 2015. Reuters/Rick Wilking

Support for Democratic presidential hopeful Bernie Sanders has been surging, with some groups proclaiming him the winner in the first Democratic debate Tuesday night. But one subject that the Vermont senator has taken flak for is gun control, and specifically his vote in favor of a 2005 bill that has protected gun manufacturers from lawsuits in cases where their weapons have been used to commit crimes.

The Protection of Lawful Commerce in Arms Act provides a unique federal legal shield for gun manufacturers and dealers by limiting lawsuits against them when their products are used in criminal or unlawful activities. Victims' advocates claim the law has kept lawsuits by cities and families of victims of mass shootings from moving forward. But the law does have certain exceptions and attorneys are increasingly trying to use the loopholes to see their cases finally go to court.

“The law really insulated those manufacturers and sellers from a normal negligence standard,” said Josh Horwitz, executive director of the Washington, D.C.-based Coalition to Stop Gun Violence. “The law slams the door in the face of survivors and victims of gun violence."

The 2005 law was intended to halt a campaign of litigation against gun makers and dealers by mostly cities and municipalities, who said the proliferation of guns was a public nuisance, said Walter Olson, a senior fellow at the Washington, D.C.-based think tank the Cato Institute who has written on gun legislation. During the last two to three years of the Bill Clinton administration, some 30 cases were brought against makers and dealers, causing some smaller companies to declare bankruptcy, such as Lorcin, which filed for bankruptcy in 1996 after many lawsuits were filed against it, Olson said. The National Rifle Association, the Fairfax, Virginia-based pro-gun lobbying group that pushed for the law, has said the lawsuits prior to 2005 attempted to bankrupt gunmakers.

While legislation is the most obvious route to limiting the number of guns in the U.S., lawsuits against gun companies can also have a similar effect — by making the gun manufacturers and sellers pay monetary damages, it could influence them to make guns safer or limit their proliferation, said Jean Eggen, a professor at the Widener University School of Law in Wilmington, Delaware, who specializes in tort law. But because the law limits lawsuits against gun companies, limiting gun sales in the U.S. has become even more difficult. That's an unpopular position among many Democratic voters, whom Sanders needs to win over to secure his party's nomination.

“If you take [the ability to sue] away by immunizing the manufacturers and sellers of guns, it takes away any kind of systemic encouragement to make guns safer or limit them in some way,” Eggen said.

During the debate, front-runner Hillary Clinton slammed Sanders for voting for the Protection of Lawful Commerce in Arms Act. Asked if Sanders is tough enough on guns, Clinton said, "Not at all."

"I voted against it. I was in the Senate at the same time. It wasn't that complicated to me," Clinton said of the law. "It was pretty straightforward to me that he was going to give immunity to the only industry in America. Everybody else has to be accountable, but not the gun manufacturers. And we need to stand up and say enough of that."

Sanders defended his support for the law during an October interview with NBC News's Chuck Todd. “If you were a gun shop owner in Vermont, and you sell somebody a gun, and that person flips out and then kills somebody, I don't think it's really fair to hold the [gun shop owner] responsible. … On the other hand, where there is a problem is there is evidence that gun manufacturers do know that they're selling a whole lot of guns in an area that really should not be buying that many guns — that many of those guns are going to other areas, probably for criminal purposes,” he said. “So can we take another look at that liability issue? Yes.”

Democratic lawmakers have rallied to overturn the law for years, arguing that it grants legal immunity to gun manufacturers and dealers. "Good gun companies don't need special protection from the law," Rep. Adam Schiff, D-California, has said. "Bad companies don't deserve it."

Gun rights groups have also taken a tough against Sanders’ support for the law. “U.S. Senator Bernie Sanders’ characterization here of the National Rifle Association-drafted ‘Protection of Lawful Commerce in Arms Act’ that he voted for in 2005 is an utter fabrication. The bill has nothing to do with protecting upstanding gun manufacturers and dealers. Instead, it gives NEGLIGENT manufacturers and dealers blanket immunity from civil lawsuits. This law is THE REASON why two parents who lost their daughter in the Aurora shooting had their suit thrown out and are now being ordered to pay more than $200,000 in legal fees to gun companies that armed James Holmes,” the Coalition to Stop Gun Violence said in a recent statement. “It is an immoral law that denies victims and survivors their day in court – a fundamental democratic right – and Sanders’ position is totally unacceptable.”

Since it was passed, the Protection of Lawful Commerce in Arms Act has barred hundreds of suits against gun manufactures from moving forward. Most of these suits are thrown out before they can even make it into the courtroom, Horwitz said.

New York City sued various gun makers in 2008 for not doing enough to stop the flow of firearms onto the illegal market. A court denied the suit to move forward, citing the 2005 law, according to the Law Center to Prevent Gun Violence.

In 2009, a federal appeals court said the Protection of Lawful Commerce in Arms Act prevented a lawsuit against the gun manufacturer Glock from moving forward. In 2001, five people injured in a white supremacist’s shooting spree — and the family of one person who died in the spree — sued Glock and some firearm importers and distributers, saying the companies intentionally imported more guns than the market demanded, benefiting from re-sales to illegal buyers.

The same year, the Illinois Supreme Court used the 2005 law to dismiss a case against a gun manufacturer by the family of a boy shot accidentally by his friend who was playing with his father’s gun. A court ruled in March that the family of a victim of the 2012 Aurora shooting couldn’t sue the websites that sold ammunition and equipment to James Holmes, who killed 12 people in a Colorado movie theater, according to Reuters. Attorneys for the defendants invoked the 2005 law in their arguments.

The law does allow for a few exceptions for lawsuits against gun companies. Gun companies can be sued if they sold a weapon to someone knowing they would commit a crime. Another of these exceptions is for negligent entrustment, said Timothy Lytton, a professor at Georgia State University College of Law who studies gun violence. Negligent entrustment is when a dangerous object, such as a gun, is given to a person knowing there is a high risk, Lytton said.

Attorneys for the families of victims killed in the 2012 Sandy Hook Elementary School shooting are using the negligent entrustment argument in their lawsuit against Bushmaster, the company that made the XM15-E2S rifle used by shooter Adam Lanza in the massacre that left 28 people dead, including Lanza and his mother. Attorneys are arguing that the model used in the Newtown, Connecticut, shooting was only slightly different from a military weapon. The military has strict oversight of the similar weapon, but no oversight exists for the storage or use of the XM15-E2S, according to the Wall Street Journal.

“The argument there is that Bushmaster created a weapon for the military and that it was negligent to market that to the general public,” Lytton said.