Gov. Nikki Haley signed the bill Friday that would make it harder for mentally ill people to get their hands on guns.

The so-called “Ashley Hall Bill” was drafted after a Beaufort woman allegedly attempted to shoot an official outside the private school in Charleston.The legislation, filed as H3560, would create a database of people judged to be mentally defective, such as those deemed by the courts to be incompetent, or people involuntarily sent to a mental institution.

The bill enables South Carolina to report the names of those who have been deemed mentally ill in court to the National Instant Criminal Background Check System. The bill, which passed the Legislature on Thursday, was supported by several law enforcement officials around the state as well as the National Rifle Association. “This is a positive example of how grassroots can bring change. It has been a wonderful experience for all of us in public office,” Lt. Gov. Glenn McConnell issued in a statement about the passage.

The legislation was drafted after police said Alice Boland, 28, tried to fire a handgun at officials at Ashley Hall school in downtown Charleston on Feb. 4. She pulled the trigger, but the gun didn’t go off because no round was in the chamber, according to investigators.

Boland had previously pleaded not guilty by reason of mental incompetence to threatening to kill President George W. Bush in 2005. But that plea didn’t appear in a federal background check when Boland went to buy the gun she took to Ashley Hall because South Carolina doesn’t share that information.

S.C. Attorney General Alan Wilson called the bill “one of the year’s most important pieces of legislation.” He said the legislation in no way infringes on the rights of “law-abiding South Carolinians” but “simply ensures that people who are not lawfully allowed to carry a gun cannot get one.”

Rep. Leon Stavrinakis, D-Charleston, one of the sponsors, said, “With the passage of this bill, no one with a criminal history of mental illness will be able to legally purchase a firearm in South Carolina.