(Corrects this July 19 story to show that incident with neighbor was this month, not last month, in 18th paragraph.)

KYOTO, Japan (Reuters) - A man suspected of torching an animation studio and killing 33 people in Japan’s worst mass killing in two decades had been convicted of robbery and carried out the attack because he believed his novel had been plagiarized, media said on Friday.

Public broadcaster NHK, which identified the 41-year-old man as Shinji Aoba, citing police, said he served time in prison for robbing a convenience store east of Tokyo in 2012 and, after his release, lived in facilities for former convicts. He had also received care for mental illness, NHK said.

The attack on Thursday in the ancient capital of Kyoto, targeting the well-known animation studio, Kyoto Animation, killed 33 people and 10 were in critical condition, authorities said. Most of the dead were killed by carbon dioxide inhalation, NHK said.

It was the worst mass killing in a country with one of the world’s lowest crime rates since a suspected arson attack in Tokyo killed 44 people in 2001.

Aoba wheeled a trolley carrying at least one bucket of petrol to the entrance of the building before dousing the area, shouting “die” and setting it ablaze on Thursday, broadcaster Nippon TV said, citing police.

“I did it,” Aoba told police when he was detained, Kyodo news said, adding that he had started the fire because he believed the studio had stolen his novel.

Police declined to comment. Aoba was under anesthesia because of burns he suffered and police were unable to question him, Nippon TV said.

He “seemed to be discontented, he seemed to get angry, shouting something about how he had been plagiarized”, a woman who saw him being detained told reporters.

“I imagine many of the people who died were in their twenties,” said 71-year-old Kozo Tsujii, fighting back tears after laying flowers near the studio in the rain. He said he drives by the studio on his daily commute.

“I’m just very, very sad that these people who are so much younger than me passed away so prematurely,” he said.

The studio had about 160 employees with an average age of 33, according to its website. That makes it a relatively young company in rapidly graying Japan.

Tributes to the victims lit up social media, with world leaders and Apple Inc's AAPL.O chief executive offering condolences.

(Graphic: Fire in Japan's Kyoto link: tmsnrt.rs/2NXcWJ5)

‘I’LL KILL YOU’

Aoba, a resident of the Tokyo suburb of Saitama, some 480 km (300 miles) east of the ancient capital of Kyoto, was believed to have bought two 20-liter cans at a hardware store and prepared the petrol in a park near the studio, Nippon TV said.

He traveled to the area by train, the broadcaster said.

Slideshow ( 15 images )

NHK showed footage of him lying on his back as he spoke to a police officer at the time of his detention, shoeless and with apparent burns on his right leg below the knee.

He had no connection with Kyoto Animation, NHK said.

None of the victims’ identities had been disclosed as of Friday. There were 74 people inside the building when the fire started, Kyodo said.

This month, Aoba had a confrontation when he complained to a neighbor about noise in the apartment building, the Mainichi newspaper reported.

Slideshow ( 15 images )

When the neighbor said the noise was coming from another apartment, Aoba grabbed the neighbor’s shirt and said: “Shut up, I’ll kill you,” the newspaper said.

BODIES PILED UP

The fire that tore through the building spread so fast not only because it was fueled by petrol, but because it was funneled up a spiral staircase and there were no sprinklers to douse it, experts said.

Nineteen of the 33 who died were found on a staircase leading up to the roof from the third floor, bodies piled on top of each other, Kyodo said, citing authorities.

Firefighters arriving soon after the fire began found the door to the roof was shut but could be opened from the outside, Kyodo said.

The victims may have rushed up the stairs to escape the blaze and found themselves unable to open the door, it added.

The fire wasn’t put out until early on Friday.

Police investigators searched the smoldering shell of the building for evidence in an investigation that Kyodo said covered suspected arson, murder and attempted murder.

Two petrol cans, a rucksack and a trolley were found near the site, and television images showed what appeared to be five long knives laid out by police as possible evidence outside the three-storey building.

Kyoto Animation, in a quiet suburb about 20 minutes by train from the center of Kyoto, produces popular “anime” series such as the “Sound! Euphonium”.

Its “Free! Road to the World - The Dream” movie is due for release this month.

“I love fighting games, all things about Japan,” said Blake Henderson, a 26-year-old Alabama native and fan of the anime studio who had come to the scene of the blaze to pay his respects.

“I love Japan so much and this one incident won’t change my entire perspective on Japan. But it still hurts.”