TAIPEI, Taiwan — The man who stabbed three people to death in Taipei appeared to have prepared meticulously for his attack, police investigators said Saturday, even as they struggled to find a motive for his spree of violence.

Two days before the man began his assault with smoke grenades and a long knife in the city’s main subway station Friday afternoon, he checked into a cheap hotel just 50 yards from the store where he ended his spree, Taiwanese police officers said.

He had left evidence of his plans in digital form, they said, and on foot and bicycle he scouted the locations where he attacked stunned shoppers and commuters.

And during his hourslong assault, he changed his outfit five times, police said, although they did not make clear exactly where or when.

“Up to now we have not been able to clarify his motive. We know only that he had a plan for this attack,” Lu Chun-hung, the chief of the criminal investigation division of the Taipei City Police, told reporters. He also sought to douse rumors that the attacker, whom police identified as Chang Wen, had acted in league with others who remained at large.

“We’ve reviewed all the surveillance camera footage and found that he acted alone and did not have any contact with anyone else,” Lu said.

Three people died from wounds suffered in the attacks, and the attacker died after apparently jumping from the fifth floor of a retail building where he had just fatally stabbed a man. Another 11 people were injured, six of whom were still in the hospital Saturday, said Taiwan’s minister of health, Shih Chung-liang.

The bloodshed drew intense public attention in Taiwan, where outbursts of deadly violence are rare.

For the second day in a row, Taiwan’s president, Lai Ching-te, and other senior officials sought to reassure residents that the government would thoroughly investigate the killings and look for lessons to prevent any similar attacks. The last similar case was in 2014, when a man went on a stabbing spree on a Taipei subway train, killing four people. He was executed in 2016.

The latest series of attacks began about 3:40 p.m. and ended a little over three hours later, according to a timeline described by Chang Jung-Hsin, the director-general of Taiwan’s National Police Agency, in a televised meeting. At the same meeting, Taiwan’s premier, Cho Jung-tai, suggested that answers were needed about why the attacker could continue his actions for so long after witnesses were already alarmed.

Police said the man set out from his hotel room and began by trying to set parked vehicles on fire. He went back to a small apartment he rented and tried to set fire to it, and then went to Taipei Main Station, pulling a small trolley holding improvised smoke grenades. He tossed the grenades near a busy concourse and entryways.