A Wisconsin firefighter is in critical condition Tuesday after a loaded firearm inside a burning building discharged and struck him, according to the fire department.

Justin Frederickson, a firefighter with the Cornell Area Fire Department, was operating on a hose line outside of a fire in the Township of Willard last week when a loaded firearm inside the burning building suddenly discharged. The bullet traveled through the wall of the building and hit him in the abdomen, Fire Chief Dennis Klass said in a news release.

"The loaded firearm discharged due to heat conditions caused by the fire, not by the intentional actions of a person," Klass said.

Frederickson was transported to a nearby hospital, then airlifted to Mayo Hospital in Eau Claire, according to the release. He underwent two surgeries and has third scheduled.

As of Thursday, Frederickson is still listed in critical condition, Cornell Area Fire Department assistant chief Matt Boulding told CNN.

"Please keep Justin's fiancée, his family, and the Cornell and Sheldon Fire Department's in your prayers," Klass said.