The militant group Islamic State (IS) has released a video purportedly showing the 17-year-old Afghan asylum seeker accused of attacking passengers with an ax and knife on a train in Bavaria, southern Germany, vowing to carry out the attack.
But German authorities have cast doubt on IS's claim of responsibility for the aassault, which left five people injured -- two of them seriously -- and would be the first committed by IS extremists in Germany.
Instead they insist that the teenager, whose identity has not been released, appears to have no direct ties to the group.
The attacker reportedly shouted, "Allahu akbar," ("God is great") as he attacked people on the regional train near the Bavarian city of Wuerzburg on July 18.
He was shot and killed by police as he tried to flee the scene, and a hand-painted IS flag was said to have been found during a search of his room.
But Bavaria's state interior minister, Joachim Herrmann, said handwritten notes in the suspect's native Pashto suggested he was self-radicalized with "no indication" he was directly connected to IS.
Herrmann said people who knew the attacker told authorities he had seemed calm, and not overtly religious or extremist.
German prosecutors said the attacker learned over the weekend that a friend had been killed in Afghanistan.
Afghanistan's ambassador to Germany said the attacker was not necessarily an Afghan national, insisting that some refugees pouring into Europe had registered as "Afghans" for legal and financial gains.
Hamid Sadeq told RFE/RL's Radio Free Afghanistan that the man in the IS video had an accent foreign to Afghanistan, appearing to suggest that he could have been a Pashto speaker from Pakistan.
"It has not been confirmed to us so far that the man that has committed the crime in Germany's state of South Bavaria is truly an Afghan national," he said.
The video released by IS's affiliated Amaq news agency on July 19, subtitled in Arabic, appears to show the teenager saying that he would carry out a "martyr operation" in Germany and presenting himself as a "soldier of the caliphate."
Amaq had earlier said the attacker "was one of the fighters of the Islamic State."
German police said the teenager posted a "cryptic message" on social media 24 hours before the attack in which he mentions the "enemies of Islam."
Among the Pashto-language writings found in the suspect's room was a passage expressing hope that "I can take revenge on the infidels and that I will go to heaven."
Police said the boy arrived in Germany without his parents two years ago, had lived in a refugee home in Ochsenfurt in the Wuerzburg area, and more recently was living with a foster family.