Five hours after a 20-minute shooting rampage that ended in the death of a 9-year-old boy riding home in a minivan with his mother, detectives from Oakdale and the state Bureau of Criminal Apprehension arrived at suspect Nhan Tran's home with a search warrant.

Among the many items of evidence detectives collected from the bottom drawer of a filing cabinet in Tran's room were two pieces of paper: a permit to purchase a firearm and a receipt for the Glock 9-millimeter handgun he had purchased from a nearby sporting goods store.

Tran, 34, who faces six felony charges — including a count of second-degree murder in the death of Devin Aryal — was found to be mentally incompetent last month by a court-appointed psychologist.

Yet he was able to clear the background check that enabled him to buy a gun from a federally licensed dealer.

That Tran was able to buy a gun goes to the heart of the gun background check debate that has been raging in St. Paul and Washington, with one side arguing the futility of trying to create a foolproof system that ends up infringing on law-abiding gun buyers, the other pointing to the urgency to improve the system to keep more guns out of the wrong hands.

It also affirms the common ground on both sides of this contentious issue: the need to reach and help the mentally ill before they do harm.

"Since the Brady Act was enacted after an attempted assassination on President Reagan, nearly 2 million people nationally have been prevented from purchasing firearms because of background checks. That's not an insignificant number," said state Rep. Michael Paymar, DFL-St. Paul, who has taken the lead in advocating for stronger gun laws in the Legislature.

Minnesota's background checks cover purchases from licensed dealers, but not private sales at gun shows, on the Internet or among private parties. Despite the defeat of universal background checks in the U.S. Senate last week, Paymar is holding out hope that background checks will be broadened and strengthened when the bill reaches the House.

He also advocates a plan that would give local law enforcement agencies greater leeway on issuing purchase or gun-carrying permits based on their knowledge of applicants.

But that kind of power raises alarm bells for gun rights supporters like state Rep. Tony Cornish, R-Vernon Center.

More stringent rules on explosives, fertilizer — and guns — have not prevented violence, he said. In wrenching testimony on gun bills from gun violence victims and their families, Cornish added, even they acknowledge that more sweeping laws can't prevent all tragedies.

No red flags

It's a haunting, unanswerable question in Tran's case.

Tran turned himself in to detectives after shooting randomly at terrorized drivers on Hadley Avenue N. that frigid Feb. 11 night.

Missy Aryal, Devin's mom, also had been shot in the arm, another woman shot while driving with her three grandchildren lost part of a finger and two other motorists narrowly avoided flying bullets.

The FBI's National Instant Criminal Background Check System (NICS) was a database created to quickly identify people ineligible to buy firearms, and relay that information to federally licensed dealers to prevent those sales. People convicted of certain crimes, fugitives, illegal immigrants and those who have been dishonorably discharged from military service are among those ineligible to buy firearms.

And those found by a court to be mentally ill "or involuntarily committed to a mental institution or incompetent to handle own affairs, including dispositions to criminal charges of found not guilty by reason of insanity or found incompetent to stand trial" also are barred.

There is no such court record, no documented red flags, for Tran relating to mental illness or a propensity for violence. And aside from a 2006 speeding ticket, no criminal record, either. None of the 18 restrictions on the state gun purchase permit, which set into motion the background check when he bought the gun, applied to Tran.

Reclusive man

But glimpses into Tran's personality reveal a troubled and reclusive man.

Along with the court psychologist's conclusions, Tran's family said he had been mentally ill for years, but they couldn't afford to get him help. They described his apparent paranoia: "He has been tormented by these thoughts of people systematically following and stalking him. He has no idea who or why they are doing this to him, he only knows that he is being targeted and has not been able to lead a normal life since this started." Tran told detectives "that cars had been following him around for a while and the persons driving the cars had been revving up their engines while parked in front of his house and waking him up."

When detectives searched his room, they found the apocalyptic calendar date of "12/12/12" scrawled all over the walls, and a note saying "Random Kill, Fake Plates."

Even when mental health issues are documented, there are problems with the background check system. Earlier this year, a Star Tribune review of state court records found that at least 84 people have been charged since 2000 with illegal gun possession or assault with a dangerous weapon even though they had previously been committed by a judge as mentally ill.

To be clear, the legal issues over Tran's mental health remain unsettled. The court psychologist's report, not a public document, concluded two things: that Tran was not mentally able to participate in his own defense, and that he could not understand that the crimes he is accused of committing were wrong.

The prosecution team with Washington County attorney's office, aiming to head off a mental illness defense, disputes those findings and has asked for a second opinion. Their psychologist's report, which will either affirm or dispute the earlier findings, will be the topic of a hearing scheduled for May 10.

Jim Anderson• 651-925-5039 Twitter: @StribJAnderson