Elliot Rodger, the man behind the deadly attacks in Isla Vista near UC Santa Barbara, was able to legally obtain three guns despite a history of depression and having been under the care of a therapist for some time.

Rodger, who died in the attack, left behind writings and videos threatening violence, but experts said there was nothing in Rodger's known history before the killings to warrant barring him from buying guns under the law.

If Rodger had issued a threat of violence against specific, identifiable victims to a psychiatrist, the psychiatrist would have been required to report it to law enforcement, the experts said, and he could have been banned from owning guns for five years.

That did not happen, and there is no evidence that Rodger made such a threat -- in fact, his writings suggest that he had worked studiously to hide his violent plan to kill people in the UCSB neighborhood.

Adam Winkler, a UCLA law professor and expert on gun laws, said that, in general, a diagnosis of mental illness doesn't affect a person's right to own a gun in California unless the matter has been adjudicated by a court or the person has voluntarily checked into a mental facility.

Shootings near UC Santa Barbara

"It's just not a surprise that someone with mental health problems would still be able to get a gun," Winkler said.

Rodger's family was caring and attentive, said family friend Adam Krentzman. Peter Rodger, the father of the attacker, "is the sweetest, nicest, most genuine, caring person, and he did everything he could," Krentzman said.

But after Elliot Rodger turned 18, he started rejecting mental health care that his family provided, Krentzman said. "He turned his back on all of it," he said. "At some point, your kid becomes an adult."

Elliot Rodger reportedly became increasingly isolated, sometimes by his own design. He complained that he couldn't make friends, but acquaintances said in interviews that he rebuffed their attempts to be friendly.

Bitterness rising in his writings and videos, Rodger apparently began to resent the students in the tight-knit Isla Vista community, where more than half of the 23,000 residents are students at nearby UCSB. He viewed himself as sophisticated and a catch, and reserved much of his venom for attractive women whom he believed spurned him, and men who had more success in dating.

One night last summer, officials said, he went to a party and tried to shove women who were sitting on a ledge. Several men intervened and pushed Rodger off the ledge instead, and he injured his ankle.

He was treated at a clinic for his injuries, and police showed up to interview him. In theory, this was an opening for an official intervention. But the officers determined that Rodger was "not a victim," a Santa Barbara County Sheriff's Department spokeswoman said Sunday, and that he had instigated the altercation.

Asked if there was anything about that incident that would have prompted authorities to follow up with Rodger, spokeswoman Kelly Hoover replied: "No."

Around the same time, Rodger apparently hatched his plan for what he called a "slaughter" and began buying semiautomatic handguns. He made the purchases legally, abiding by California's background check system and waiting periods.

Despite his troubles, it does not appear that he triggered any warnings -- he had no criminal history; he had never explicitly threatened anyone or been deemed a risk to himself or others; he had never been ordered to submit to involuntary mental health treatment; he had no history of addiction.

Even a diagnosis of serious mental illness, in itself, would not have prevented Rodger from buying a gun under California law, said Lindsay Nichols, staff attorney with the advocacy group Law Center to Prevent Gun Violence.

His family suspected he was somewhere on the autism spectrum, and he had been in therapy since childhood. Rodger was prescribed psychotropic drugs but declined to take them, he wrote in a statement before he killed the six students and apparently took his own life.

Dr. George Woods, a San Francisco psychiatrist who lectures on mental health and the law, said Rodger appeared to have been in an early phase of pre-psychosis. The ability to mask symptoms is common, he said.

"Oftentimes, you'll see that the paranoia is in the service of the delusion," Woods said. "They aren't telling people their business."