Blocks from where nine people were killed in a mass shooting at a historic Charleston, S.C., black church in 2015, the Democratic presidential front-runner, Senator Bernie Sanders of Vermont, was confronted on Tuesday night about his past support for a law that gave immunity to gun manufacturers in wrongful death lawsuits.

Former Vice President Joseph R. Biden Jr. raised questions about his onetime Senate colleague’s commitment to preventing gun violence, taking a similar tack as Hillary Clinton did in the Democratic Party’s nominating contest in 2016.

He zeroed in on Mr. Sanders’s vote to approve the Protection of Lawful Commerce in Arms Act in 2005, saying that the law has undermined efforts to hold gun manufacturers accountable after a spate of mass shootings.

“That has caused carnage on our streets,” Mr. Biden said during the CBS and Congressional Black Caucus Institute debate in Charleston.