Interior Minister Thomas de Maiziere said the 17-year-old also left a goodbye letter saying he prayed that he could take revenge on all infidels.
The stabbings took place Monday night on a train shortly after it left Wurzburg for Treuchtlingen. Five passengers were injured, and police shot the teen dead after a confrontation. The suspect has not been named.
At a news conference Wednesday in Berlin, de Maiziere called the YouTube video authentic and said the teenager appeared to have been "driven" by ISIS propaganda.
In the video, the teen described himself as a soldier of the caliphate and a martyr.
However, the minister said, he acted as a lone wolf and "the video does not contain any indications as to whether there was an order from ISIS." He said that it's unclear when the video was made.
German officials have said the ISIS connection was under investigation.
ISIS has claimed responsibility for the attack, and its news agency, Amaq, on Tuesday released the video of the young man speaking in Pashto, waving a knife at a camera calling himself "a soldier of the caliphate."
The interior minister also indicated the teenager may be from Pakistan, not Afghanistan as authorities initially said Tuesday. CNN has contacted Pakistan's Ministry of Foreign Affairs and is awaiting an official reply.
On Monday night, the attacker exited a bathroom on the train armed with a knife and ax and began stabbing passengers.
According to German police, about 20 to 30 people were on the train, which made an emergency stop short of the station at Wurzburg-Heidingsfeld.
The assailant jumped off the train, and was chased and confronted by police. He attacked officers with his ax, and they opened fire, shooting him dead, police said.
Four people -- members of the same family and tourists from Hong Kong -- were injured on the train. Another woman was wounded after the assailant jumped from the train and fled.
Two people remain in critical condition, according to German police. De Maiziere said he is not sure if all the victims will survive this "brutal act."
German officials reported that on Saturday, the teen learned a good friend had been killed in Afghanistan.
Inside his room, police said they found a hand-drawn flag resembling the one used by ISIS. They also found notes in Pashto, written in Arabic and Latin characters in the assailants' room.
Bavarian Interior Minister Joachim Herrmann said the attacker came to Germany as an unaccompanied minor a year ago, eventually settling in Ochsenfurt, in Bavaria.
He was taken in by a foster family two weeks ago.
Chief Prosecutor Erik Ohlenschlager said Tuesday: "We have no indications that he was already radicalized before he came to Germany."
Germany absorbed more than 1 million refugees last year. Some Germans have been concerned over the presence of terror groups in the country -- both the potential for attackers to slip in with migrants and the concern they may be able to radicalize disaffected youths.
Three Syrian men were arrested last month on suspicions they were planning to carry out a mass casualty attack in Duesseldorf.
De Maiziere said Wednesday, "We did a lot of work last year to prevent attacks and to improve security in Europe and Germany."
He listed security measures taken in recent months, including making journeys abroad to terroristic organizations punishable, and improving collaboration with national and international security services.
But the minister warned that "Germany might face in the future lone-wolf attacks by Islamists such as the one carried out by the 17-year-old man. Like several other EU countries, like the entire EU, Germany is also a target area of international terrorism. I have said it for a long time. The situation is serious."