A database of mentally ill people for gun background checks is confusing and costly, and many states don't take part.

WASHINGTON — Swept along by the tide of outrage and sorrow after the 2007 Virginia Tech massacre, Congress passed a law to try to prevent future tragedies by keeping guns out of the hands of the mentally ill.

The measure, signed by President George W. Bush, promised to strengthen the 14-year-old National Instant Criminal Background Check System by establishing incentives and penalties to prod states to submit records of people legally barred under federal law from buying guns — including those who had been committed to mental institutions.

But today, that promise remains unfulfilled. More than half the states haven't provided mental health records to the federal database that gun dealers use to check on buyers. And the gap in dealing with the mentally ill is just one of myriad problems that have hampered background checks.

In the shock that followed the Sandy Hook Elementary School killings last month in Newtown, Conn., improving that system has emerged as a major focus of the Obama administration's plans for combating gun violence. Vice President Joe Biden, who could make recommendations to the president as soon as Tuesday, said he believed there was support for expansion to cover private gun sales, which make up much as 40% of all purchases but do not require background checks.

The history of the last change, the NICS Improvement Amendments Act, shows how difficult it will be to fix this broken system. Many states haven't even begun to figure out which of their mentally ill residents should be included, or how to gather paper records from courthouses and mental hospitals. There is federal funding for the work, but not nearly enough.

Last year, after the 2010 Tucson shootings by a mentally ill Jared Lee Loughner, President Obama acknowledged in an opinion column that the law "hasn't been properly implemented."

The background check system, which became effective in 1998, was part of a 1993 law that prohibited people from possessing guns if they were convicted of a felony, addicted to drugs, committed domestic violence or were involuntarily sent to a mental institution.

Gun rights organizations, including the National Rifle Assn., have fought expansion of those checks. Though the NRA says it supports making sure the names of "violent schizophrenics" are in the database, the group also made it tougher for states to comply — by successfully lobbying for a provision in the 2007 law that requires an appeals process so the mentally ill can seek to have their gun rights restored. States must set that up before they can receive federal grants to help collect records.

As many as 2 million mental health records are not in the system, the National Center for State Courts has found. Gun control advocates say plugging holes like that could be one of the most effective ways to stem gun violence.

"Having 2 million prohibited purchasers out there whose names are not in the background check database is a ticking time bomb," said Mark Glaze, executive director of Mayors Against Illegal Guns.

Tighter standards in 2007 might have prevented the Virginia Tech shooter, Seung-hui Cho, from buying guns. He passed two background checks even though a judge had found him to be a danger to himself and ordered him to get mental health treatment. The state had interpreted the law to cover only in-patient treatment, so his name wasn't submitted. Virginia has since changed those rules.

Loughner too was able to pass background checks despite mounting evidence of mental problems; he had not been involuntarily committed to an institution or convicted of crimes, the main triggers under the law.

The 2007 improvement act was supposed to speed development of the system by providing grants to states to help pay for hunting down records and setting up electronic databases. But Congress has handed out just a fraction of the grants allowed. Last year, $125 million was authorized under the law, but just $5 million was appropriated.

"The cost of making those changes far outweighs the grant money coming in," said Carol Cha, acting director for homeland security and justice issues at the Government Accountability Office. "So states are having to make that difficult choice."

There has been progress, though. The number of gun sales denied for mental health reasons increased from 365 in 2004 to 2,124 in 2011, according to FBI data, although that still accounts for less than 2% of all denials. And the database now has 1.2 million mental health records, up from about 200,000 in 2004.

But most of those records came from just 12 states, while nearly half the states have sent in just a handful of names, according to a July GAO report. "Most states have made little or no progress in providing these records," the report said.

Federal agencies, such as the Drug Enforcement Administration and the Department of Defense, also have been slow to submit relevant records.