Police in Munich say they have arrested a 16-year-old Afghan friend of David Ali Sonboly, who killed nine people at a Munich shopping centre on Friday.
They say the teenager met the gunman shortly before the attack, knew Sonboly had a gun and knew that the gunman was interested in Norwegian mass killer Anders Behring Breivik.
Sonboly, 18, had been planning his attack for a year, police said earlier.
They say he had a Glock pistol which he may have bought on the "dark net".
A statement on Munich police's Facebook page says: "There is a suspicion that the 16-year-old is a possible tacit accomplice to the attack."
The youth reported to police immediately after the shooting on Friday, and was interviewed as somebody with a connection to the attacker, police said.
But in the course of the interviews, police discovered discrepancies in his statements.
They say they are now investigating him on suspicion of failing to report a planned crime.
The investigations will have to show to what extent, if any, he was involved in a Facebook post inviting people to meet at a cinema complex near the main railway station in Munich.
The attacker himself had put up a post on a fake Facebook account before his attack, inviting people to come to the fast food restaurant where the shooting began.
'Not specifically targeted'
Seven of the dead in Friday's shooting at the Olympia shopping centre were teenagers - two Turks, two Germans, a Hungarian, a Greek and a Kosovan.
A further 35 people were injured, but only four of them have bullet wounds - many were hurt while fleeing the scene.
State government officials told a news conference that the victims of the attack had not been specifically targeted and were not classmates of the gunman.
Robert Heimberger, head of Bavaria's criminal police, said the gunman had been planning the attack since he paid a visit last year to the town of Winnenden - the scene of a school shooting in 2009 - and took photographs.
He said it was likely the Glock pistol - which had been reactivated - was bought on the "dark net" market, an area accessible only with the use of special software. It had been a theatre prop, but had been restored to fully functioning.
Sonboly was said to be a keen player of "first-person shooter" video games.
Mr Heimberger added that the parents of the gunman remained in shock and were not able to be interviewed.
Officials earlier raised the possibility of a link to Breivik, whose own attack was carried out five years earlier to the day.
The Munich prosecutors' office told the news conference that the gunman had spent two months as an inpatient at a mental care facility in 2015 and was afterwards treated as an outpatient.
"The suspect had fears of contact with others" and also depression, Thomas Steinkraus-Koch said.
There was no evidence of any political motivation for the attack, he added.