The scene looks like something out of an American action film — a man lies in the operating room surrounded by surgeons and members of the bomb squad who attempt to remove an explosive device lodged in his body. This, however, was not the makings of a big screen terror plot but an actual event that took place in Texas.

Medical personnel at the San Antonio Military Medical Center were faced with a daunting challenge in January 2017 when a man was brought into the emergency room with a "potentially explosive" firework embedded in his leg. Doctors first thought the wound was a typical trauma, but an X-ray later revealed that a mortar-type firework had entered his thigh.

According to the case study published last month in The Journal of Emergency Medicine, the 44-year-old man told doctors he was attempting to set off the firework when the accident occurred. He said that the explosive did not go off at first so he tried to reload it. At that point an explosion occurred and an unknown part of the device entered his leg.

The patient's femur had been fractured in the blast and his wound was "grossly contaminated".

"When you hear that, yes, [the device] could be something that could potentially be explosive, of course everybody kind of gets a little bit on edge," Dr Lane Thaut, an emergency-medicine resident at San Antonio Military Medical Center (SAMMC) who treated the patient, told Live Science.

Considering the medical team were concerned that the firework could explode while they attempted to remove it, the hospital called in Explosive Ordnance Disposal (EOD) technicians, along with the local fire department.

During the operation, the surgeons were advised to irritate the wound with water in order to wet the fuse and prevent it going off. They were also instructed to avoid using electrocautery, a procedure which uses electricity to heat and remove unwanted tissue and seal blood vessels.

After successfully removing the firework, a metal rod was inserted into the patient's thigh to treat his fracture and skin grafts were used to seal the wound.

In the case study the authors stress the importance of other emergency units being aware of the protocols to manage a similar incident.

"This has the potential to be, unfortunately, an event that may be encountered by a provider in an emergency room setting," co-author Dr Andrew Murtha, an orthopaedic surgery resident at SAMMC, who also treated the patient noted. "Understanding how to manage the patient without risking harm to other patients and the medical team is something that's important to recognise."

The patient recovered from his injuries and was discharged after two weeks in the hospital.