The people in Germany are shocked that such an event could occur. The question asked by many was: "Where did he get the gun?" Since there is strict gun control, the black market is considered to be the likely source.
I think that Shelagh's response is the most probable concerning the cause/motivation to commit these acts by a young person. Commentary does not suggest any political motivation. Watching the events happen I was angered by how CNN went into their usual speculative mode, engaging terrorist experts to add their two cents adding to the hype while German news reported only known facts. When asked speculative questions, they repeatedly replied that they would not engage in speculation and would only report was they could confirm. In my view, that is responsible reporting. Media hype with round the clock coverage as with CNN does more harm than good. That type of reporting may provide incentives for those who seek attention.
The stabbing event that occurred a week earlier on a train was horrific enough to cause concern. Imagine what would have happened if the man had used a gun. Although one can kill without guns, mass murders occur with guns, especially by a lone person.