MUNICH - The teenager behind the deadly shooting rampage at a Munich mall had planned his attack for a year and chose his victims at random, investigators said Sunday, as officials take a harder look at gun control measures after it was revealed the shooter likely got his weapon online.

Bavarian investigator Robert Heimberger said the shooter, an 18-year-old German-Iranian identified only as David S., visited the site of a previous school shooting in the German town of Winnenden and took photographs last year, then set about planning Friday's attack in which he killed nine people and wounded some three dozen others before taking his own life.

"He had been planning this crime since last summer," Heimberger told reporters.

There is so far no evidence that the shooter knew any of his victims, or that there was any political motivation behind the attack, said Thomas Steinkraus-Koch, of the Munich prosecutors' office.

Get Breaking News Delivered to Your Inbox

The suspect received both inpatient and outpatient psychiatric treatment last year to help him deal with "fears of contact with others," Steinkraus-Koch added. He said medication had been found at his home but that investigators needed to talk with his family to determine whether he had been taking it.

Heimberger said there were "many more terabytes" of information to evaluate, and that the teenager's brother and parents were still not emotionally up to being interrogated by police.

Heimberger said the McDonald's restaurant were most of the victims died was a hangout for youths with an immigrant background. He identified those who died as being of Hungarian, Turkish, Greek, and Kosovo Albanian background and said one was stateless.

Witnesses say the attacker shouted anti-foreigner slogans, even though his parents came to Germany seeking asylum decades ago.

In the aftermath of Friday's attack, Bavaria's top security official urged a constitutional change to allow the country's military to be able to be deployed in support of police during attacks. Because of the excesses of the Nazi era, Germany's post-war constitution only allows the military, known as the Bundeswehr, to be deployed domestically in cases of national emergency.

But state Interior Minister Joachim Herrmann told Welt am Sonntag newspaper that the regulations are now obsolete and that Germans have a "right to safety."

"We have an absolutely stable democracy in our country," he said. "It would be completely incomprehensible ... if we had a terrorist situation like Brussels in Frankfurt, Stuttgart or Munich and we were not permitted to call in the well-trained forces of the Bundeswehr, even though they stand ready."

Munich deployed 2,300 police officers to lock down the city Friday night, calling in elite SWAT teams from around the country and neighboring Austria, during the shooting at the mall and a nearby McDonald's restaurant.

It was the second attack targeting victims apparently at random in less than a week in Bavaria. On Monday, a 17-year-old Afghan asylum-seeker wounded five people in an ax-and-knife rampage near Wuerzburg, for which the Islamic State group has claimed responsibility.

In the fog of the Friday attack, witnesses had reported as many as three shooters, and the city's public transit was completely shut down for hours as authorities hunted for the shooter.

Herrmann said in other European nations it goes without saying that the military is brought in to aid during "extreme domestic threats" and he said Bavaria would urge changes so that it is allowed in Germany as well.

Weapons are strictly controlled in Germany and police are still trying to determine exactly how the shooter obtained the Glock 17 used in the attack.

Heimberger said it appears "very likely" that the suspect purchased the weapon illegally online. It was a pistol that had been rendered unusable and sold as a prop, then was restored to a fully functioning state. Its serial numbers were filed off and David S. had no permit to purchase weapons, authorities have said.

Even though it was an illegal weapon, Vice Chancellor Sigmar Gabriel suggested Sunday that even stricter controls on legal access to weapons are needed, telling the Funke Media Group that "we need to do everything further possible to curb the access to deadly weapons and strictly control them."

"How can it be that an unstable, or possibly even mentally ill, 18-year-old comes into possession of a firearm?" he asked.

Germany's top security official, Interior Minister Thomas de Maiziere, said that Germany's weapons regulations are already "very strict" and appropriate. He said authorities first need to determine where the shooter got the weapon from.

"We'll then have to look very carefully at whether there then needs to be a possibility for additional legal action," he said.