Germany has some of the world's strictest gun laws. But that did not stop Saturday's Munich attacker - Ali David Sonboly, an 18-year-old dual Iranian-German national - from carrying out his shooting spree.
The assailant most likely obtained his pistol illegally and did not have a license, German police officials said. That development could have implications for a country that has already exhausted most legal means to prevent such shooting sprees.
"Germany has a good system of legal gun ownership, but illegal firearms pose a big problem," said Nils Duquet, a weapons expert in Belgium who works for the Flemish Peace Institute. According to Duquet, there are millions of illegal weapons in Europe.
Following two horrifying school shootings in 2002 and 2009, German MPs passed stricter gun legislation that made it harder to legally obtain weapons. Buyers younger than 25 must now pass a psychological exam before being able to acquire firearms in Germany. Shooting incidents significantly dropped as a consequence.
Theoretically, those measures might also have stopped Sonboly from being able to buy a gun legally. Officials believe the suspect could have been depressed, and a video shows the attacker saying he had gone through "inpatient treatment".
Most mass shootings in Europe that are not associated with international terror groups have been carried out with legally obtained weapons.
Duquet also emphasised that the attacker's use of a pistol was significant. "If you want to buy an illegal gun in Europe, what's important is having the right networks. For assault rifles, you need better criminal connections."
Among several other factors, the borderless Schengen Area and Europe's proximity to current or former war zones have facilitated illegal-weapons transports into the continent. An increasing number of terrorist attacks over the past two years were carried out with illegal pistols and semi-automatic rifles from Eastern Europe.
At least some of the weapons used in the January 2015 shootings in Paris were reportedly purchased legally in Slovakia, according to the Guardian and the Wall Street Journal. Metal pins were placed in the barrel to render the guns useless, allowing for their sale. But the pins were hammered out illegally after purchase.