US lawmakers moved to boost funding of the national background check system for firearm sales, a small but symbolic step toward broader gun law reform following recent mass shootings.

The measure would provide $19.5 million to help states submit records to a federal database aimed at preventing felons and the mentally ill from buying weapons.

Supporters of the amendment, which passed 260 to 145 as part of a $51 billion spending bill for the Commerce and Justice Departments expected to be approved later Thursday, say the measure would keep guns out of the hands of potentially dangerous people.

The issue was brought into shocking focus last weekend when a deranged student went on a rampage in Santa Barbara, California, fatally stabbing and shooting six people before killing himself.

Police said the suspect purchased his guns legally, reportedly despite years of psychological therapy.

- 'Only as good as the data' -

"Our national criminal background check system is only as good as the data you put in it, and right now all the information isn't getting into the system," the bill's sponsors, led by House Democrat Mike Thompson, said in a statement immediately after the vote.

Jose Cardoso grieves at a makeshift memorial in front of the IV Deli Mart, in Isla Vista, California on May 25, 2014 Robyn Beck, AFP/File

"When this happens, we can't enforce the law, and criminals, domestic abusers, or dangerously mentally ill individuals who otherwise wouldn't pass a background check can slip through the cracks and buy guns."

Such holes in the system in 2007 allowed a 23-year-old Virginia Tech student to purchase guns with which he killed 32 people in one of the deadliest mass shootings in US history.

Two years earlier, a judge had declared the man mentally ill, but authorities did not report the finding to the FBI's National Instant Criminal Background Check System (NICS) database.

The House measure must pass the Senate for it to head to President Barack Obama's desk.

The legislation would raise funding to a total of $78 million for fiscal year 2015 for NICS, which has prevented more than 1.5 million felons and domestic abusers from buying guns since it was created by Congress in 1993.

States have been slow to get more disqualifying records into the system. Thompson and sponsors including Republican Peter King said 12 states have submitted fewer than 100 mental health records.

- 'The drumbeat quiets' -

The bill is backed by gun-control groups including Sandy Hook Promise, created after a 2012 shooting at an elementary school that left 26 people dead.

A student weeps during a candlelight vigil for those affected by a killing spree in Isla Vista, May 24, 2014 Robyn Beck, AFP

Following that tragedy, Obama and his Democrats called for bills expanding background checks to include sales on the Internet and at gun shows, and banning assault weapons and high-capacity magazines.

Those efforts failed last year, handing a victory to gun groups like the National Rifle Association.

But Democrat Lois Capps, who represents Santa Barbara, says the gruesome killing spree that devastated her district and other rampages should prod Congress to action.

"How many more of these mass shootings do we need before we act?" Capps asked on the House floor, adding that too often after such tragedies, "the drumbeat quiets and we are left with inaction."