A 45-year-old man was taken into custody after a fire erupted and ravaged a two-story building in Los Angeles while police were trying to investigate him for battery, authorities said.

The fire broke out Thursday evening in the Westlake district building, which had small businesses on the ground floor and about eight residential units on the second floor.

A fire engine was already on scene in support of the police operation when smoke became visible, Los Angeles Fire Department spokesperson Margaret Stewart said in a statement.

MORE THAN 100 FIREFIGHTERS BATTLE MASSIVE LOS ANGELES APARTMENT COMPLEX FIRE, 1 INJURED

Police had evacuated the building prior to the fire, which was knocked down by more than 100 firefighters in just under an hour, Stewart said.

Police Capt. Aaron Ponce said the victim of the alleged battery is the sister of the suspect, who broke into her apartment.

fire in LA

Firefighters battle fire inside a two-story apartment building in Westlake on Jan. 26, 2023, in Los Angeles, California. (Jason Armond / Los Angeles Times via Getty Images)

Officers found the door barricaded and when they pushed it open they saw the man armed with a knife, Ponce said.

During a standoff the man threw burning clothing and trash at police from a balcony, Ponce said.

CLICK HERE TO GET THE FOX NEWS APP

The man was eventually taken into custody and transported to a hospital for treatment of non-life-threatening injuries. His name was not immediately released.

"The possible involvement of this patient with the fire is under investigation and no further information is available at this time," Stewart said.