Employees at a building owned by Kyoto Animation, one of Japan’s premier anime production houses, were in the middle of the work morning Thursday in their sleepy suburb when a man entered the building.

Moments later, he began to spray a flammable liquid around the office, police said.

As he did so, he screamed at the startled employees: “Die!”

Then came the inferno. The flames spilled out through the windows, charring the outside of the building. Smoke rolled through the corridors and stairwells. The workers made a frantic — and futile — attempt to escape. Some collapsed as they ran upstairs in a desperate bid to reach the building’s roof.

Firefighters wrestled for hours with the blaze. In the end, at least 33 people were confirmed dead in the apparent arson attack, according to the Kyoto City fire department, with many more injured. Authorities said injuries ranged from serious to critical.

It was the worst death toll in Japan from fire since a Tokyo office building blaze claimed 44 lives in 2001.

Though a 41-year-old suspect is now in police custody, the motive behind the startling attack on an animation house remains unclear and largely incomprehensible. The incident has shaken Japan, a country where mass violence remains relatively rare and animated production is a national obsession.

Japanese Prime Minister Shinzo Abe described it as an “arson and murder case” in a message on Twitter. “It’s so tragic that I am at a loss for words,” he wrote.

Founded in 1981, Kyoto Animation is one of the country’s most important producers of anime, a Japanese-style of animated art that often features vibrant graphics and fantastical storytelling.

Though the company initially worked in support of more famous studios like Tokyo’s Studio Ghibli, in recent years Kyoto Animation’s own anime productions have garnered international acclaim.

Notable titles include “Full Metal Panic!,” “K-On!” and “Sound! Euphonium.”

The tragedy that struck Kyoto Animation on Thursday took place at the company’s No. 1 studio, a three-story office building on the outskirts of Kyoto.

The building, humble and built of yellow brick, is where Kyoto Animation’s main line production takes place, according to Anime News Network.

Emergency services said that the fire broke out at around 10:30 a.m. At the time, there were roughly 70 people inside the building.

The fire that the man started appears to have set off secondary explosions. Video footage showed smoke billowing from the complex as rescue workers rushed to the scene.

Inside, panicked workers attempted to escape the blaze by running to the building’s large, flat roof. Fire officials said many did not make it, and victims were found on the top floor and on staircases that would have led them to safety.

Locals who were nearby ran to the building with a ladder to try to reach people on upper levels, according to Japanese media reports.

It took firefighters about five hours to contain the blaze, the Kyodo news agency reported. In addition to the 33 confirmed dead, another 36 were injured and hospitalized.

For those in the anime world, the fire brought shock and despair. Kyoto Animation had been known not just for the quality of its work but also the kindness with which it treated its staff — an oddity in an industry where long hours and low pay are the norm.

“Kyoto Animation are a rarity in the anime business: they treat their people well, they strive to own part of their works, and their creations are consistently excellent, at the very least on a technical level,” Mike Toole, an editor at large for the Anime News Network wrote on Twitter.

The company was founded by a husband-and-wife team and employed more women than most anime production houses. Mikihide Daikoku of the Kyoto City fire department said that 20 of the 33 people who died in the blaze were women.

Hideaki Hatta, co-founder and president of the company, told reporters after the fire that the studio had been receiving threats.

“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.

An unnamed 61-year-old woman told the Asahi Shimbun newspaper that she had opened the front door of her home after the intercom rang and found a large man kneeling on the ground, covered in flames and burns.

Believing the man to be a victim, she doused the man with water and called an ambulance. But police officers surrounded him and began to ask questions — and then took him into custody.

“They ripped me off,” she recalled him saying, the Asahi Shimbun reported.

Crawshaw reported from Hong Kong and Taylor from Washington.