Firefighters arriving Thursday morning at the scene of a blaze in a boarded-up, abandoned home in Mastic heard a person yelling from inside the two-story structure — and rescued what police described as a squatter from the house.

The victim, a man, had what fire officials described as “significant burns” to his hands and face and was airlifted to the Trauma/Burn Unit at Stony Brook University Hospital, where he is being treated for non-life-threatening injuries. Officials said the cause of the fire was under investigation.

advertisement | advertise on newsday

Suffolk County fire officials said the fire was reported in a 911 call at 11:59 p.m. Wednesday and that Mastic Fire Department Chemical Company 1 was first on the scene with Chief Rudy Sunderman and ex-Chief Steve Zaglool. They were assisted by a civilian and by Suffolk County police officers, removing wood covering building windows to reach the man trapped inside.

A crew from the Mastic Ambulance Company provided medical attention at the scene before the man was transported to Stony Brook, fire officials said. Firefighters from five departments — Mastic, Mastic Beach, Brookhaven, Center Moriches and East Moriches — responded to the call. Fire officials said about 30 members were on the scene with three engines, a heavy rescue truck and “multiple” fire police units. A Suffolk deputy fire coordinator also assisted at the scene.

The fire was extinguished just before 3 a.m., fire communications officials said.