A team of surgeons were flown to the site of a construction accident in North Texas earlier this month, in order to amputate the leg of a worker who’d gotten caught in a trenching machine.

According to news reports, the incident occurred at a new housing development that was under construction. Once firefighters from the Frisco Fire Department reached the victim, they realized that they would not be able to extricate his leg from the blades of the machine in which it was entangled.

Doctors arrived by air ambulance and a surgeon amputated the leg on-site, which allowed the man to be freed from the machine. The victim was flown by air ambulance to a nearby hospital for treatment. He is expected to survive the injury.

Officials said the man and his co-workers were laying pipes at a housing development.