You would think that when a disturbed man threatens police officers and tries to arrest them, and when he tells detectives he has an illegal way to buy guns, something could be done about him before he kills a cop.

This time, apparently, it couldn’t. The fact that it couldn’t is especially tragic and frustrating here and now, almost eight years after then-U.S. Rep. Gabrielle Giffords was shot and six people were killed by a Tucson man with untreated, severe schizophrenia.

Tucson police spent months dealing with Ryan Schlesinger, getting injunctions against him, trying to get him into court-ordered mental-health treatment, and finally obtaining an arrest warrant for him. It was in serving that warrant, a last-gasp effort to deal with Schlesinger in the criminal justice system instead of the mental-health realm, that Deputy U.S. Marshal Chase White was killed.

Two gaps in state laws and practices may help explain why it came to this, despite the progress made in catching people with mental- health crises and in trying to keep them away from guns.

One relates to concealed-carry permits and gun purchases. Schlesinger told detectives in July that even though he was prohibited from possessing firearms, he could get one, according to the criminal complaint against him. He told Tucson police detectives “he was aware that he could circumvent a background check to purchase additional firearms because he has a valid CCW,” the complaint says.

That’s true, according to three experts I talked with. A concealed-carry permit, or CCW as it’s known, doesn’t mean much in Arizona anymore, since any person permitted to have a gun can carry it concealed. But it does mean that federally licensed firearms dealers don’t have to perform a background check of the buyer on the usual NICS database before selling the CCW-holder a gun.

“The process that you had to go through to get the CCW is the background check and criminal history,” said Andrew LeFevre, executive director of the Arizona Criminal Justice Commission. “If you have the CCW, then you don’t have to go through the NICS background check.

“There clearly is a loophole in the system.”

Formally speaking, a CCW permit becomes invalid if the holder is convicted of a felony or is the subject of a protection order or injunction that prohibits them from possessing weapons, Charles Heller of the Arizona Citizens Defense League told me. But that’s just a formality unless some authority ensures that the holder gives up his permit.

“If he lays his invalid permit on the counter, the store would have no way of knowing that,” Heller said. “However, the DPS’s job once somebody gets an order of protection, it’s their job to collect the permit.”

I contacted the Arizona Department of Public Safety about this issue, but they did not answer my questions Friday.

We don’t know if Schlesinger exploited this loophole to get the gun he is accused of using to kill White, but we know that officials are aware of the problem and have so far failed to solve it. Gov. Doug Ducey proposed closing the loophole in a package of public-safety measures he offered after the Parkland, Florida, massacre this year, but as with most of his proposal, the Legislature killed it.

The other gap in the law that may have benefited Schlesinger limits who can be forced into state-ordered mental-health treatment.

Arizona has an expansive state law allowing any adult to petition for someone else to be forced into a mental-health evaluation. The four criteria that can make a person eligible for a court-ordered evaluation are if they are:

• a danger to themselves,

• a danger to others,

• persistently or acutely disabled,

• gravely disabled.

Tucson police were serving an order to get Schlesinger evaluated in August 2017 when the ordeal began that ended with the killing Thursday night. Schlesinger barricaded himself in his home, but police eventually entered and tased him when he reached for a gun, the criminal complaint against Schlesinger says.

In the ensuing months, he repeatedly made vague and direct threats to officers, especially over the gun they had seized from him, the complaint says. In August, I attended a court hearing in which officers obtained injunctions against Schlesinger because he had shown up at the home of a family member of one officer and threatened others. He went on to try to conduct a citizen’s arrest of an officer who had participated in the August 2017 incident at his home.

Back in 2017, the Tucson Police Department officers were able to get Schlesinger evaluated, but what that evaluation found has not been made public. However, only certain conditions qualify a person to be forced into court-ordered treatment. In essence, they have to be treatable conditions such as schizophrenia, bipolar disorder or major depression.

Jared Lee Loughner, who shot Giffords and others attending the Congress on Your Corner event on Jan. 8, 2011, had untreated schizophrenia that improved markedly when he was forced into treatment after being arrested. He might have qualified for court-ordered treatment in Arizona, but he didn’t get it in time.

What will not qualify a person to be court-ordered into treatment is a diagnosis like antisocial or narcissistic personality disorder.

“The end result of an involuntary commitment is an order that requires somebody to participate in treatment,” said Paula Perrera, the behavioral health director for Pima County. “That typically means medication. Medications really don’t have any effect on personality disorders.”

So that leaves the public, social-service workers and the officers in Tucson’s mental-health unit stuck in dealing with some people who have serious mental problems but who cannot be forced into treatment. Most mentally ill people are not dangerous to other people, but a subset of them are, as we’ve been painfully aware for these eight years.

A lack of treatment for that dangerous subset is a problem aggravated by the easy availability of firearms, either using the CCW loophole or through the wide access to guns in our culture.

“The scary part is he’s one of many,” Tucson Police Chief Chris Magnus told me, referring to Schlesinger. “People think these are rare cases, but there are a lot more than the public wants to know.”

Contact: tsteller@tucson.com or 807-7789.