TOKYO -- A man shouted "Die!" as he sprayed a flammable liquid all over an animation studio in Japan on Thursday, July 18, and set the building on fire, killing 33 people as some victims collapsed in a desperate bid to reach the roof.

The president of the studio, Kyoto Animation, said the company had been repeatedly threatened before the attack, but gave no further details.

A series of explosions triggered an inferno that swept through the three-story workspace, emergency services said. Footage showed smoke billowing from the complex on the outskirts of Kyoto as rescue workers rushed to the scene.

The suspect, a 41-year-old man, was in police custody and was being treated for his injuries in a hospital, officials said.

Mikihide Daikoku of the Kyoto City fire department said 33 people have been confirmed dead, and 20 of them were women. Another 36 people were injured and hospitalized, 10 of whom are in serious condition.

Many bodies were found on the top floor, and some of the victims collapsed on the stairs leading to the roof, according to fire officials.

The apparent arson attack was the worst death toll in Japan since a blaze in a Tokyo office building in 2001 claimed 44 lives.

Naoyuki Takao, deputy chief of the Kyoto police investigative department, said the fire took hold immediately after the man ignited what appeared to be gasoline.

About 70 people were inside the complex when the blaze erupted, he said.

It took firefighters about five hours to contain the blaze, the Kyodo news agency reported.

The blaze broke out around 10:30 a.m. at a three-story studio of Kyoto Animation Co., which is known for producing the TV series "K-On!", "Clannad" and "Miss Kobayashi's Dragon Maid," among others.

Company president, Hideaki Hatta, told reporters that the studio had been receiving threats frequently.

"We have received protests against our company, not a few of them if not on a daily basis. There were murder emails including those which said 'die,' " he told broadcaster NHK.

This article was written by Akiko Kashiwagi and David Crawshaw, reporters for The Washington Post.