More than half the states are not complying with a post-Virginia Tech law that requires them to share the names of mentally ill people with the national background-check system to prevent them from buying guns, an Associated Press review has found.

The deadline for complying with the three-year-old law was last month. But nine states haven't supplied any names to the database. Seventeen others have sent in fewer than 25, meaning gun dealers around the U.S. could be running names of would-be buyers against a woefully incomplete list.

Officials blame privacy laws, antiquated record-keeping and a severe lack of funding for the gap the AP found through public records requests.

Eleven states have provided more than 1,000 records apiece to the federal database, yet gun-control groups have estimated more than 1 million files are missing nationwide.

"If the mental health records are not current from our sister states, the quality of our background check is going to be compromised," said Sean Byrne, acting commissioner of the Division of Criminal Justice Services in New York, a state that has submitted more than 100,000 records.

Congress has doled out only a fraction of the $1.3 billion it promised between 2009 to 2013 to help states and courts cover the costs of the 2008 law.

For some states, the amount of federal grant money they could be penalized for not complying is less than what it would cost them to get their records-sharing systems up to speed.

The Jan. 8 shooting rampage in Tucson, Ariz., that killed six people and left Rep. Gabrielle Giffords grievously wounded has put more emphasis on the struggle to disarm the mentally ill, even though the man arrested in the attack wouldn't have been on the no-purchase list. Jared Loughner was considered so mentally unstable that he was kicked out of community college, yet because he was never deemed mentally ill by a judge or committed to an institution, he was able to legally buy the gun police said he used.

Since 1968, federal law has banned certain mentally ill people from buying guns, including those who have been deemed a danger to themselves or others, involuntarily committed or judged not guilty by reason of insanity or incompetent to stand trial. The nationwide background-check system — which is also used to prevent convicted felons from buying guns — was established under the 1993 Brady Bill.

A few state agencies shared mental health records voluntarily for years, but the Virginia Tech massacre in 2007 spurred passage of legislation that required states to submit the records or risk losing up to 5 percent of the federal funding they receive to fight crime.

In the Virginia Tech rampage, student Seung-Hui Cho shot 32 people to death and committed suicide. He was able to buy two guns, even though he had been ruled a danger to himself during a court hearing in 2005 and was ordered to undergo outpatient mental health treatment.

Federal officials said that Cho should have been barred from buying weapons but that the records were never forwarded to the background-check system. Virginia officials, however, said state law required the names of only those committed to mental hospitals. The loophole has since been closed by state law, and people in Virginia who undergo outpatient treatment are now entered into the database.

California has shared records of more than 250,000 people, Virginia more than 100,000, according to records AP obtained in a Freedom of Information Act request in late 2010.

The states that have failed to submit any mental health records are: Alaska, Delaware, Idaho, Massachusetts, Minnesota, New Mexico, Pennsylvania, Rhode Island and South Dakota.

Seventeen states submitted very few records: Hawaii, Illinois, Kentucky, Louisiana, Maine, Mississippi, Montana, Nebraska, New Hampshire, New Jersey, North Dakota, Oklahoma, Oregon, South Carolina, Vermont, Wisconsin and Wyoming.

Any penalties for failing to comply with the 2008 law are probably years away — they don't become mandatory until 2018, and federal authorities can forgive states in the meantime.

If the penalties are imposed, some states could lose hundreds of thousands of dollars or more. But in several states, sharing the records could require millions of dollars in upgrades.

In fiscal year 2009, the U.S. government dispensed about $10 million to the states to comply, not the $187.5 million pledged, according to the Justice Department. A year later, $20 million was provided.

"Unfortunately, our Congress talked the talk but did not walk the walk," said Abby Spangler, founder of ProtestEasyGuns.com, a gun-control group.

Several states have also struggled to amend their privacy laws that restrict the release of health information, and others have had to create an appeals process for those who say they have been wrongly barred for mental health reasons from buying a gun.

Gerard Ramker, deputy director of the Justice Department's Bureau of Justice Statistics, said the department is aware that states are struggling to comply with the law.

"There may be technological barriers between local and state agencies that keep record systems from communicating with each other," Ramker said. "Also, state laws or regulations could prohibit agencies from sharing mental health information with law enforcement authorities."

Rep. Carolyn McCarthy, D-N.Y., who ran for Congress after her husband was killed and her son paralyzed in a 1993 shooting rampage on a Long Island Rail Road train, introduced the measure.

"When we started talking to states, we learned that some of these records are kept in boxes down in some basements, so this is labor-intensive at the very least," she said. "It's going forward. I sure would like to see more states implementing this, but we're fighting for the money."