The Air Force has admitted that its failure to enter Devin Patrick Kelley’s domestic-violence conviction into the federal NICS database enabled him to purchase the assault rifle that he used to murder 26 people in a Texas church.

What the Air Force has not said is that the ultimate reason Kelley should not have been able to buy the gun last April is this:

He should have still been incarcerated for assaulting his wife and fracturing his infant son's skull in 2012.

In fact he should have still been behind bars at the time of Sunday’s shooting.

Had justice been done, Kelley would have only been due for release at the end of a five-year term, which would have come on Tuesday.

Back on Nov. 7, 2012, Kelley faced sentencing for having violated Article 128 of the Uniform Code of Military Justice, which states, “ Any service member offering or attempting to do bodily harm to another individual, through unlawful violence or force, whether or not the offer or attempt is consummated, is guilty of committing assault.”

Article 128 further says, “Any service member who… assaults and inflicts severe bodily harm intentionally with a weapon or without it… will be held guilty of committing aggravated assault and will be punished as directed by a court martial.”

The maximum punishment for aggravated assault on a child under the age of 16 is “a dishonorable discharge… and 5 years of confinement.”

If the maximum is possible when the victim is 15, it should be all but mandatory when the victim is an infant.

And a dishonorable discharge would have automatically disqualified Kelley from ever legally owning a firearm, whether or not the Air Force notified the FBI keepers of the database that he had been convicted of a domestic-violence crime.

Instead, Kelley got off with a sentence that Air Force records list as: “ Bad-conduct discharge, confinement for 12 months.”

A person with a bad-conduct discharge and a sentence of no more than a year can still purchase a firearm unless the charge involved a domestic violence.

That is where the Air Force’s admitted failing came into play.

Before he could purchase the Ruger 8515 assault rifle at a San Antonio gun shop, Kelley had to fill out a standard Form 4473 Firearms Transaction Record.

Section 11 has a series of nine questions that the applicant is required to answer by checking either a box marked “Yes” or a box marked “No.” The last question reads:

“Have you ever been convicted in any court of a misdemeanor crime of domestic violence?”

Kelley checked the box for “No,” but there was nothing in the NICS database to indicate it was a lie. The sale was approved.

Equally shaming for the Air Force was a question that Kelley answered truthfully. The seventh question read:

“Have you ever been discharged from the Armed Forces under dishonorable conditions?”

Here, Kelley also checked “No,” but this was accurate.

And that leaves two questions for the Air Force.

How can someone who fractures an infant’s skull be discharged under circumstances that are anything but dishonorable?

And how can that person receive anything but the maximum prison term, much less just 12 months?

The 12 months is an important number because anything more is presumed to result from the equivalent of a felony and disqualifies the person from owning a firearm whether or not it was a domestic-violence crime. No more than 12 months is presumed to result from a misdemeanor, which does not preclude owning a firearm unless domestic violence is involved.

The military judge in the case, J. Wesley Moore, has also given 12-month sentences to a colonel convicted of possessing child pornography in March of this year and to a lieutenant convicted of aggravated and abusive sexual contact and assault upon a commissioned officer in August 2014.

But Moore did hand down a nine-year sentence for rape and a 12-year sentence for sexual assault on a child, both in 2012.

Exactly why Moore gave Kelley such a light sentence is difficult to determine without the court record, and the judge was not available for comment.

What is clear is that the Air Force error in not reporting the domestic violence would not have mattered had Moore imposed a sentence on Kelley in keeping with an assault on an infant so serious the tiny victim was left with a fractured skull.

Kelley almost certainly deserved the maximum, and if he had received it, he would not have been freed until Nov. 7 of this year, two days after Sunday’s shooting.

And he would have come out with a dishonorable discharge, barred from ever legally obtaining a weapon such as he used to proceed from baby battering to the outright mass murder of children along with adults, among them a pregnant woman.

One more question for the Air Force:

How can fracturing a baby’s skull be classified a just bad conduct?