A volunteer firefighter collapsed and died of a heart attack while battling a four-alarm blaze in New Jersey Sunday night, authorities say.

The 54-year-old firefighter, Robert Meyer, died while responding to the Hydrair warehouse in Union Beach at about 6 p.m. Sunday, officials say. He was running in and out of the building, which was engulfed in flames, when he collapsed on the street.

He was later pronounced dead.

Meyer, a member of the Union Hose Fire Company since 2005, was "extremely dedicated," according to Deputy Chief Chris Tuberion.

"As everyone can imagine, this has been an extremely difficult time for our company and our community," Tuberion said in a statement, adding condolences for the Belford Engine Fire Company in Middletown, where Meyer had been an active member for over 20 years.

No one was in the building when the fire started, and no other injuries were reported.

The blaze burned well into the night and sent thick black smoke into the sky as heavy flames tore through the building's roof. The fire burned so hot that firefighters were initially unable to get inside the building, officials said.

The smoke could be seen for several miles, witnesses said. Investigators say they can't rule out a faulty exterior electrical connection as a cause.

Hydrair is a company that sells hydraulic tools, hoses and other equipment.