Virginia State Police are conducting an exhaustive review of their "Do Not Sell" list for firearms after a man who shot a police officer in the head in 2013 was recently allowed to buy a gun legally.

Kashif Bashir, the man who shot Alexandria Officer Peter Laboy, was able to buy a gun because a "human error" was made in adding his name to a list of people barred from buying firearms, Virginia State Police said.

Bashir, 33, was re-arrested last month after he was found with guns and accused of setting fires, Prince William County officials said. For shooting Laboy, he was found not guilty by reason of insanity and released from a mental health facility in 2018.

Gun ownership by an acquitted insane person is a crime in Virginia, and Bashir was supposed to be on the "Do Not Sell" list in the state. But a search warrant shows he got his hands on two guns and two suppressors. He bought one of the guns at a store in Manassas.

State police said an internal review "revealed a human error was made during the approval process by the FTC [Firearms Transaction Center]."

"The Virginia State Police recognizes the severity of this situation and is taking the necessary steps to address the matter," police said in a statement.

News4's discovery stunned Alexandria Commonwealth's Attorney Bryan Porter.

"I don't think there's any way to portray it other than a tragedy narrowly averted," he said.

"If one of these situations was able to fall through the cracks, of course I'm concerned that it might occur again in the future, or that there could be other similar cases that are in the same posture right now," Porter added.

State police are reviewing their records to make sure they have not missed any other defendants found not guilty by reason of insanity, a state police department spokeswoman said.

Bashir is behind bars in Prince William County and is set to appear in court this month.

Laboy was on motorcycle patrol in Old Town Alexandria on Feb. 27, 2013 when he tried to pull over Bashir for suspicious activity. Bashir shot Laboy in the head and then led police on a chase.

The officer suffered life-changing injuries and was forced to retire from the job he loved.