Judging from two recent tragedies — one here and one in Louisiana — enacting stronger gun laws is only half the battle to reduce gun violence.

In both cases, careful enforcement of the law would have kept guns out of the hands of people who managed to buy them and, according to police, commit heinous crimes.

Dylann Roof bought the .45-caliber pistol he allegedly used to kill nine people gathered for Bible study at Emanuel AME Church in June, despite having admitted to possessing illegal drugs when he was arrested in February. By federal law, the drug possession should have barred him from purchasing a gun.

The gun store did run a background check, but an error in his arrest record kept the FBI from finding it in time to stop the sale.

Then last week, John Russell Houser shot to death two women and injured nine more, before shooting himself to death, in a movie theater in Lafayette, La.

He used a .40-caliber handgun that he purchased from a pawn shop in Alabama six years after a Georgia judge committed him to mental health treatment against his will when it was determined he was a danger to himself and others.

Somehow the committal wasn’t reported to the state and national databases used to keep guns out of the hands of people with significant mental illnesses.

Earlier, he had been denied a concealed weapons permit in Russell County, Ala., based on arson and domestic violence allegations, even though the victims declined to pursue charges.

There is no reason to assume that these are isolated instances where those with mental illnesses or criminal backgrounds were able to purchase firearms because the system didn’t work properly.

Clerical errors happen, as in the case of Dylann Roof. Delaying the purchase might have given the FBI time to discover the error and deny permission to purchase the gun.

And in the case of John Houser, the problem might have been a decentralized, complex court system. Experts have been concerned that probate judges do not report every mental health commitment. Some are apparently concerned about HIPPA privacy restrictions.

The theater shooting and the shooting of the Emanuel Nine are ample reason for a review of both state and federal systems of recording and sharing data about people who should not possess firearms, either because they have a mental illness or a criminal background.

Courts should be assured that reporting mental health information in these circumstances is not an abridgement of a person’s right to privacy. Or, if it does somehow violate HIPPA, that law should be amended.

Sixth District Rep. Jim Clyburn, D-S.C., has introduced sensible legislation that would stop retailers from selling firearms before a criminal background check on the buyer is finished. Present law allows stores to sell a firearm three business days after the check was started, regardless of whether it has been completed.

Further, the firearm sales at gun shows and flea markets, which are now unregulated, should be. Purchasing a gun is purchasing a gun. The same restrictions as to someone’s mental health and criminal background should apply.

It is true, sadly, that handguns can easily be acquired under the table.

But the system of checking buyers before they purchase firearms can be a deterrence — if it is used effectively.