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 Tokyo Fire Department said 17 passengers were injured, including three seriously.
Not all of them were stabbed and most of the injuries were not serious, the agency said.
The attacker, only identified as a man in his 20s, was arrested on the spot and was being investigated on suspicion of attempted murder, NHK said.
His motive was not immediately known.
Nippon Television reported that the suspect told police he used an earlier train stabbing case as an example.
NHK said witnesses told police that the attacker was wearing a bright outfit, a green shirt, a blue suit and a purple coat, and looked like a comic book character or someone going to a Halloween event.
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.
NHK said the suspect, 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 while he was trying to figure out what happened, he heard an explosive noise and saw smoke wafting.
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 Tokyo Olympics closing ceremony, a 36-year-old man stabbed 10 passengers on a commuter train in Tokyo in a random burst of violence.
The suspect later told police that he wanted to attack women who looked happy.
While shooting deaths are rare in Japan, the country 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.
In 2018, a man killed a passenger and injuring two others in a knife attack on a bullet train.
In 2016, a former employee at a home for the disabled killed 19 people and injured more than 20.