(CNN) -- Moments after his train left a station in Taipei on Wednesday, a young Taiwanese man randomly stabbed passengers before his violent fury ended when he was forced to the ground, police said.
At least four people were killed and 22 others injured in the incident -- the first such attack since the East Asian nation's mass rapid transit (MRT) system opened in 1996, media in Taiwan and nearby Hong Kong reported.
According to police, the suspect, a 21-year-old college student, began attacking people 20 seconds after his train left Longshan Temple Station in Taipei.
Staff were alerted something was wrong after people hit an emergency button, and the train stopped at the next station, Jiangzicui.
The man was subdued by Taipei City Police "along with MRT staff and courageous passengers," the Taipei City Police Department said in a press release.
The suspect was identified as Cheng Chieh, a second-year environmental engineering student at Tunghai University in Taichung, Taiwan's third largest city.
Cheng had been considering the attack for some time, a police spokesperson told reporters after the incident.
During questioning by police, Cheng said he had wanted to do "something big," like killing on the train network, when he was in elementary school, according to the director-general of New Taipei City's police department, Chen Kuo-en. Later, when the suspect was in high school and college, he told his classmates of the idea, Chen said.
Cheng had no medical record of mental illness, according to the police director-general. But the vice president of Cheng's university said there were indications from the student's activities on social media that he could be mentally unstable.
"We got a tip from his former high school classmates around the end of April, and that tip said the alleged killer posted something on his Facebook page saying 'I'm going to do something big,'" Tunghai University Vice President Tsai Jen-Teng told CNN.
The college arranged a formal counseling session for Cheng on May 9 but he failed to show up, Tsai said. Several days later, he attended another meeting with a military officer, and "seemed to be acting quite normally," he said.
Cheng transferred to Tunghai University last summer after struggling to maintain his grades at a military academy. "He failed over half of his courses," Tsai said.
He lived in the Taipei area, close to where the stabbing occurred, according to Tsai.
Tsai said the university received no other indication from Cheng's college classmates that he had been acting unusually: "We were really surprised."
The university has opened its chapel for people to pay their respects and pray for the victims and their families. "We are really sad and thinking about the families who have been affected," Tsai said.
Before he boarded the train, Cheng allegedly bought two fruit knives from a supermarket, the New Taipei City Police Department director-general said, adding that the suspect showed no signs of remorse for the attack.
The incident has sparked a debate online about whether the death penalty is appropriate punishment for such attacks. A Facebook group named "Indefinitely supporting death penalty for Cheng Chieh" had over 32,000 "likes" as of Thursday.
Several Facebook fan pages supporting Cheng have appeared following the stabbing, with names like "Go Cheng Chieh" and "Love Cheng Chieh fans' special page." However, many more netizens have rallied against these support pages, calling on users to report the sites and flood them with negative comments.
Since the incident, city police announced they had taken several steps to bolster security on the rapid transit system, including deploying 80 special officers at stations and aboard trains.