Washington Gov. Jay Inslee signed legislation that will notify law enforcement if someone fails a background check after trying to buy a gun.

The new law, which takes effect in July, requires gun dealers to notify the Washington Association of Sheriffs and Police Chiefs (WASPC), within five days of a denial. The Washington State Patrol must then incorporate that information into its electronic database, accessible to the state's law enforcement agencies.

This will not just keep guns out of the hands of those who are not eligible to have them, but keep the public and our law enforcement officers safe," Inslee said as he signed the bill.

The new law allows WASPC to establish a grant program that would allow local law enforcement to conduct investigations into people who illegally tried to get a firearm.

"We want there to be criminal consequences if you knowingly, illegally try to purchase a firearm," said Democratic Rep. Drew Hansen, a sponsor of the measure. "There's no mechanism for that to happen right now. This bill creates that mechanism."

The measure also requires the creation of a statewide notification system so that those who have stalking, sexual assault, domestic violence or other court protection orders against someone can be automatically notified if the person they have the court order against tries and fails to buy a gun.