Police secures the area inside a shopping center in Munich on July 22, 2016 following a shooting. (AFP)
German police have arrested an Afghan friend of the gunman who killed nine people during a rampage at a shopping center in Munich.
"We suspect that this boy, aged 16 years, could have been aware of the act," said a statement released by the police on Sunday.
The young boy, who was not identified in the statement, had originally contacted police to give information on the attack on Friday, but police later found contradictions in his statements. 
On Friday, an 18-year-old man, David Ali Sonboly, with no criminal record went on a shooting spree at the Munich Olympia Shopping Center, and killed nine people before he shot himself. Over thirty others were also injured in the shooting.
According to the German daily Bild, Sonboly and the recently-detained Afghan knew each from the psychiatric department of the clinic in which they were both receiving treatment.
Candles and flowers lie in front of the Olympia shopping center on July 24, 2016 in Munich. (AFP) 
Meanwhile, German police announced that Sonboly had been planning his crime for a year.
Berlin issued a terror alert following the shooting, with many fearing that Germany had become a new target for Daesh.
But later, investigators ruled out any link between the attack and Daesh -- which has staged deadly attacks in other European countries like France and Belgium -- after a forensic sweep was carried out into Sonboly’s home, showing that the student had suffered from mental disorders and had been eagerly seeking to learn about mass killings.
Officials said Saturday that Sonboly, who used a 9mm handgun to target his victims, was inspired by white supremacist, Anders Breivik, who massacred 77 people in Norway five years ago.