The flag was found in the room of the man who seriously wounded four people and injured several others on a regional train in the city of Wuerzburg, Bavaria state interior minister Joachim Herrmann told ZDF public television.
German police kill Afghan teen after train axe attack
The teenager was shot dead by police as he tried to flee.
Earlier, Herrmann had said the assailant had arrived as an unaccompanied minor in Germany and had lived at first in a shelter and then more recently with a foster family in nearby Ochsenfurt.
A spokesperson for the interior ministry had said it was "quite probable that this was an extremist attack", adding that the assailant had shouted "Allahu Akbar" (God is greatest).
However, he stressed that the investigation was ongoing and that the teenager appeared to have acted alone.
The attack happened around 9:15 pm (1915 GMT) on Monday on the train running between Treuchlingen and Wuerzburg in Bavaria.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ