A man brandishing a knife on a Tokyo commuter train stabbed several passengers before starting a fire, which sent people scrambling to escape and jumping from windows, police and witnesses said.
The fire department in Japan's capital, Tokyo, said 17 passengers were injured, including three seriously.
Media reports said the perpetrator, a 24-year-old man dressed in Batman's Joker costume, attacked passengers as many party-goers headed into the city centre for Halloween gatherings.
"I thought it was a Halloween stunt," one witness told the Yomiuri newspaper, recalling the moment he saw other passengers running towards his train car. "Then, I saw a man walking this way, slowly waving a long knife."
The attacker's motive was not immediately known, but Nippon Television reported that the suspect told police he used an earlier train stabbing case as an example.
Tokyo police officials said the attack happened inside the Keio train near the Kokuryo station.
Television footage showed a number of firefighters, police officials and paramedics rescuing the passengers, many of whom escaped through train windows.
In one video, passengers were running from another car, where flames were gushing.
National broadcaster NHK said the perpetrator, after stabbing passengers, poured a liquid resembling oil and set fire, which partially burned seats.
Shunsuke Kimura, who filmed the video, told NHK that he saw passengers desperately running and that while he was trying to figure out what happened, he heard an explosive noise and saw smoke.
He also jumped from a window but fell on the platform and hurt his shoulder.
“Train doors were closed and we had no idea what was happening, and we jumped from the windows,” Mr Kimura said.
“It was horrifying.”
The attack was the second involving a knife on a Tokyo train in two months.
In August, the day before the closing ceremony of the Tokyo Olympics, a 36-year-old man stabbed 10 passengers on a commuter train in a random burst of violence.
The perpetrator later told police that he wanted to attack women who looked happy.
Japan has had a series of high-profile knife killings in recent years.
In 2019, a man carrying two knives attacked a group of schoolgirls waiting at a bus stop just outside Tokyo, killing two people and injuring 17 before killing himself.
A man killed a passenger and injured two others in a knife attack on a bullet train in 2018.
And in 2016, a former employee at a home for the disabled killed 19 people and injured more than 20 in a stabbing spree.