By Cory James

OYSTER BAY, N.Y. (CBSNewYork) — It was a very close call for a pilot who crashed his plane on Long Island on Sunday afternoon.

CBS2’s Cory James was at the scene in the hamlet of Old Bethpage, where officials said the pilot nearly hit a building.

READ MORE: NYC Hospitality Alliance: Mayor De Blasio 'Grinch' For Vaccine Mandate That May Keep Tourists With Young Children Away

Many would say that pilot is lucky to be alive. The mangled plane crashed right on top of a fence that is feet away from an abandoned building, a place officials said is the old recycling center in the town of Oyster Bay.

Firefighters were seen spraying the crushed plane down with fire retardant foam shortly after the crash that happened at around 1 p.m.

Authorities said a 57-year-old man was the pilot and the only person on board the small aircraft when it went down, and according to the Oyster Bay Supervisor Joseph Saladino, the man flying the twin-propeller Cessna had just taken off from Republic Airport, which is about four miles away.

“All of a sudden I saw out the window this small plane coming right towards the house,” Old Bethpage resident Robbie Gerson said. “It was almost gliding sideways so I knew something was wrong and then I heard some popping sounds, too.”

READ MORE: Amazon Web Services Outage Spells Trouble For MTA App Users, Among Others

“We’re told one of the engines failed. At that point, the pilot tried to turn around to return to the airport and then the second engine failed, and the plane dropped very quickly,” Saladino said. “We believe he was communicating with the emergency personnel before he left in an ambulance. They offered to put him in a helicopter and he said, ‘No way. I don’t want to go back up in the air.'”

MORE FROM CBS NEW YORK:

CBS2 was told that pilot had to be pulled out of the plane by first responders. He is believed to be from Bellmore and was taken to Nassau University Medical Center.

While James did not immediately learn the extent of the pilot’s injuries, officials said he is in stable condition.

The National Transportation Safety Board was said to be en route to the crash site to continue the investigation.

MORE NEWS: 'West Side Story' Returns To Paterson For Special Screening

CBS2’s Cory James contributed to this report

Cory James