Agents with the Bureau of Alcohol, Tobacco, Firearms and Explosives leave the Baltimore family home of David Katz on Aug. 26, the day he attacked a video-gaming competition in Florida, killing two people before turning the gun on himself. (Jose Luis Magana/AP)

David Katz’s family had worried about him. As a 13-year-old, he was sent to two mental health facilities. His mother repeatedly called police to their Columbia, Md., home for issues with him — “about 20 times,” by his count. After she took away his video game controllers, “he actually punched a hole in my door,” she once said, according to Maryland court records.

Long before police say Katz opened fire at a video-game competition in Jacksonville, Fla., on Sunday — shooting a dozen people and killing two of them before taking his own life — the warning signs added up.

But Katz, 24, was still able to legally buy a pair of handguns in Baltimore, authorities said, which he brought to Florida and used in his attack.

Experts said despite Katz’s weeks spent at mental-health facilities and encounters with law enforcement, none of it was enough to bar him from purchasing a gun in Maryland. He became the latest attacker who had alarmed people around him before going on to unleash violence. Six months earlier, law enforcement officials acknowledged that they had repeatedly failed to act on warnings about the teenager charged with killing 17 people in his former high school in Parkland, Fla. — another shooting suspect who purchased his guns legally despite concerns about his mental health.

“When we look at these incidents of mass shootings, it’s easy to look in the rearview mirror and say, ‘I don’t believe it, this is so stupid that they let this person purchase a gun,’ ” said Daniel Webster, director of the Johns Hopkins Center for Gun Policy and Research. “When we’re looking at the Parkland shooter, for example, those signs were much, much, much clearer that this was a very disturbed and violent young man. I think with a case like David Katz, it’s not so clear-cut at all.”

Katz’s history is laid out in court records filed in Howard County Circuit Court as part of his parents’ divorce. In these records, they state that Katz was committed to a pair of Maryland mental-health facilities in 2007: First for nearly two weeks in August and September, then for nearly two weeks in November and December.

Both facilities declined to comment, citing privacy laws. The court filings also state that Katz was sent in January 2008 to a Utah company that describes itself as a “therapeutic wilderness program for troubled teens.” The company did not respond to a request for comment.

Federal law prohibits people who have been involuntarily committed to mental institutions from buying guns. Under current Maryland law, people can be blocked from buying firearms if they have been involuntarily committed to such a facility or were voluntarily admitted for more than 30 consecutive days.

Neither of Katz’s stays at the facilities reached the 30-day threshold, the court records from Elizabeth and Richard Katz’s divorce show. While the filings describe David Katz as being “committed to a mental institution,” they do not state whether his commitment was deemed involuntary at the time.

Attempts to reach Katz’s parents since the shooting have been unsuccessful, though authorities say they are cooperating with the investigation.

For adults to be involuntarily committed, someone must file a petition for emergency evaluation that is then approved by a judge, according to Michelle Horner, assistant professor of psychiatry at Johns Hopkins School of Medicine. For minors, even if they do not want to go, that would not be considered an involuntary commitment if parents consent on their behalf, she said.

“The parent can have a child institutionalized, whether [the children] want to or not,” Horner said. “They’re the ones who consent. Of course we always involve the patient . . . but it’s really the parent who decides that for the child.”

Maryland lawmakers passed strict gun-control laws in early 2013, following the shooting of 20 children and six adults at Sandy Hook Elementary School in Newtown, Conn., adding the measure that prevents people who had been involuntarily committed from obtaining firearms. This year, after 17 students and staff were killed in Parkland, Maryland lawmakers passed a “red flag” bill that would let people petition courts to seize guns from people deemed to be a risk; it takes effect in October.

Even this type of law can work only if people who recognize the danger someone poses speak up, said Christopher Trainor, who ran the Hyattsville, Md., field office of the Bureau of Alcohol, Tobacco, Firearms and Explosives, from fall 2008 until spring 2012. Often, he said, that falls to relatives.

“It’s really incumbent upon the family to say, ‘Hey, we think this guy’s having some problems, we’re really concerned he might hurt himself or somebody else,’ ” he said.

Even if Katz had been involuntarily committed in 2007, the facilities at which he was treated may not have been required in 2013 to retroactively report his stays, according to Joshua Sharfstein, a professor at the Johns Hopkins School of Public Health and former secretary of Maryland’s public health department.

The court filings described the Katz family’s efforts to get David Katz treatment, including visits with “a number of different mental health professionals,” arranging weekly counseling sessions and agreeing to have him prescribed antidepressant drugs.

In a court transcript from 2007, Katz’s mother was asked whether her son posed a threat to her safety. She responded: “I can’t envision anything more than the pushing and shoving that has gone on infrequently, but . . . it’s occurred in the past.”

Howard County police records obtained by The Washington Post show that law enforcement officials were summoned to the family’s home on multiple occasions for domestic disputes.

In late December 2006, one day after Katz turned 13, a police officer wrote that Katz’s mother said she and her son had “a verbal dispute” over the television’s volume and “his overall lack of respect toward her and his grandmother.” A year later, officers were called back a day after Katz’s 14th birthday. The police report describes Katz as the caller and says he “stated that he called police because his mother is being unfair to him. He stated that she keeps punishing him by taking away his video games.”

Another transcript in the court record states that Katz’s mother took away some of his gaming equipment because he had been playing until 4 a.m. on school nights.

“I’d get up and find that he was just walking around the house in circles, just walking in circles,” she continued, according to the transcript. “He had gotten so angry that I put his gaming controllers in my bedroom behind the locked door that he actually punched a hole in my door.”

While mental health is often cited as an explanation after shooting rampages, experts say that is overemphasized. The FBI released a study earlier this year examining dozens of active shooters, finding that approximately 25 percent of those attackers had diagnosed mental health issues.

“If you look at the available facts, how many people had some treatment in their youth for mental health conditions, and what number of them go on to commit mass murder, the answer is the most infinitesimal fraction,” Webster said. “A very large share of the population has mental health conditions, a very tiny fraction of them are seriously violent.”

Authorities have not publicly identified a motive for the shooting Sunday at Jacksonville Landing, a riverfront hub of restaurants. Jacksonville Sheriff Mike Williams said “the suspect clearly targeted other gamers” at the competition, ignoring others in the restaurant.

“Witnesses say that when he lost, he kind of went off the rails and started shooting,” said a law enforcement official familiar with the investigation, who spoke on the condition of anonymity to discuss an ongoing probe. “Based on his mental health situation, maybe that was enough to put him over the edge.”

Officials have declined to discuss Katz’s gun purchases. An ATF spokesman said the agency would not discuss questions about how Katz obtained his guns and referred questions to local police. A spokesman for the Maryland State Police, which conducts background checks for gun purchases in the state, said the Jacksonville Sheriff’s Office had asked the agency not to release information about Katz or how he obtained his gun, citing the ongoing investigation in Florida.

The Jacksonville Sheriff’s Office declined to answer questions about the gun purchases and the investigation. A spokeswoman reiterated a message the office had put out on Twitter, saying it would not take calls from reporters regarding the case but instead release updates on the investigation through that social media platform.

Even though the gunfire was in Jacksonville, the South’s most populous city, it was not of Jacksonville. The suspect and victims alike had come in from out of town. By Tuesday morning, two days after the attack, the Jacksonville Landing reopened for business as usual.

The police tape was gone and the walkways were quiet, save a handful of lingering television news crews. Some flowers were laid at a sign with the Landing’s name; a few tourists wondered where to go to see the city’s downtown.

By Tuesday afternoon, police shifted to a different act of violence in the city: a shooting last week at a high school football game left one teenager dead and two others injured. The Jacksonville Sheriff’s Office said they had arrested a 16-year-old in that case.

Wang reported from Jacksonville, Fla.