Japanese authorities say 33 people are dead after a man screaming "You die!" burst into an animation production studio in Kyoto, doused it with a flammable liquid and set it on fire early Thursday in an attack that shocked the country and brought an outpouring of grief from anime fans.

Thirty-six other people were injured, some of them critically, in a blaze that sent people scrambling up the stairs toward the roof in a desperate — and futile — attempt to escape what proved to be Japan's deadliest fire in nearly two decades. Others emerged bleeding, blackened and barefoot.

The suspect, identified by police only as a 41-year-old man who did not work for the studio, was injured and taken to a hospital. Police gave no details on the motive, but a witness told Japanese TV that the attacker angrily complained that something of his had been stolen, possibly by the company.

Police are investigating the man on suspicion of arson.

Most of the victims were employees of Kyoto Animation, better known as KyoAni. It was founded in 1981 as an animation and comic book production studio with its hits including Lucky Star, K-On! and Haruhi Suzumiya.

The company does not have a major presence outside Japan, though it was hired to do secondary animation work on a 1998 Pokemon feature that appeared in U.S. theatres, and a Winnie the Pooh video.

'There was an explosion'

The fire started in the three-storey building in Japan's ancient capital after the suspect sprayed the unidentified accelerant, police and fire department officials said.

Footage on Japan's NHK television network showed grey smoke billowing from the charred building. Other footage showed windows blown off.

Rescue officials set up an orange tent outside the studio building to provide first aid and sort out the injured. Fire department officials said more than 70 people were in the building at the time of the fire and many of them ran outside.

"There was an explosion, then I heard people shouting, some asking for help," a female witness told TBS TV. "Black smoke was rising from windows on upper floors, then there was a man struggling to crawl out of the window."

An aerial view shows firefighters battling the fire in this photo taken by Kyodo News. (Kyodo/Reuters)

Japanese media reported the fire might have been set near the front door, forcing people to find other ways out of the building.

The building has a spiral staircase that may have allowed flames and smoke to rise quickly to the top floor, NHK reported. Fire expert Yuji Hasemi at Waseda University told NHK that paper drawings and other documents in the studio also may have contributed to the fire's rapid spread.

Firefighters found 20 bodies on the third floor and some on the stairs to the roof, where they had apparently collapsed, Kyoto fire official Kazuhiro Hayashi said. Two were found dead on the first floor, and 11 others on the second floor, he said.

The Kyoto fire department said it had completed its search of the building.

Incident condemned

"Why on Earth did such violence have to be used?" company president Hideki Hatta asked in condemning the attack. Hatta said his company has received anonymous death threats by email in the past, though he was not linking them to Thursday's attack.

"I am heartbroken," Hatta told reporters. "It is unbearable that the people who helped carry Japan's animation industry were hurt and lost their lives in this way."

Prime Minister Shinzo Abe called the attack "too appalling for words" and offered condolences.

The fire was the worst mass killing in Japan since a man stabbed and killed 19 people at an assisted living facility in western Tokyo in 2016.

A fire in 2001 in Tokyo's congested Kabukicho entertainment district killed 44 people in its worst known case of arson in modern times. Police never announced an arrest in the setting of the blaze, though five people were convicted of negligence. In 2008, 16 people died in a blaze at a movie theatre in Osaka, near Kyoto.