An armed man was fatally shot during a standoff with police and SWAT in California Monday moments after the house he had barricaded himself in exploded in flames, according to police.

The man was shot outside a home in Upland following the hourslong standoff that kicked off around 4 p.m., when deputies from the San Bernardino County Sheriff’s Department attempted to serve a search warrant.

He began firing shots at the deputies from inside the residence, located at Cloverdale Avenue and West 15th Street. When Upland Police officers responded to the scene, he fired more shots before he barricaded himself inside, the Upland Police Department (UPD) wrote in a statement Tuesday morning. Upland is a city in San Bernardino County. 

an aerial shot of a house on fire in Upland California

A house in Upland, California catches fire during a standoff between an armed man and police. (Fox 11)

BOAT CAPTAIN FOUND GUILTY FOR 2019 CALIFORNIA BOAT TRAGEDY THAT KILLED 34

A SWAT team was then called to help get the suspect to surrender and a standoff ensued.

About six hours later, the house erupted on fire, and video from the scene shows the entire structure engulfed in heavy flames.

The man emerged from the inferno, and law enforcement at the scene opened fire, striking the suspect, who was pronounced dead at the scene. 

an aerial shot of a house on fire in Upland California

After around six hours into the standoff, the house erupted on fire and video from the scene shows the entire structure engulfed in heavy flames. (Fox 11)

CALIFORNIA HOMEOWNER GETS JUMPED BY ARMED ROBBER, OPENS FIRE WITH CONCEALED HANDGUN

No officers or deputies were injured, the UPD said.

The deceased man has not been publicly identified.

Crews with the Upland Fire Department responded to the fire and multiple nearby residences were evacuated, according to reports.  

The fire has since been brought under control.

upland police car

An Upland Police Department vehicle. (UPD via Facebook)

"The scene has been rendered safe and there is no threat to the public, but the immediate area remains closed for further investigation," the UPD statement reads.

CLICK HERE TO GET THE FOX NEWS APP

It is unclear what sparked the fire, although there were reports of the smell of gas and an explosion before the flames, according to Fox 11.

Details about the search warrant were not immediately provided.