A camera positioned incredibly close to an entangled whale captured the marine mammal’s dramatic rescue on a video, which was released this week by the Sea Shepherd Conservation Society.

The footage highlights the dangers associated with illegal usage of gillnets, which wound up ensnaring the clearly stressed female humpback whale. Gillnets, commonly used by commercial and artisanal fisheries, consist of vertical panels of netting meant to allow the heads of fish to pass through, but that entangle the fish’s gills upon withdrawal.

Humpback Whales Get IMAX Treatment: Photos

“The Sea Shepherd crew rescued a whale entangled in an illegal totoaba gillnet in the Gulf of California,” read the Sea Shepherd post at Facebook, where the dramatic video was shared. “It was heartbreaking to see this whale entangled in a net, but we managed to save it and after four hours of hard work, the whale swam free!”

Totoabas are critically endangered fish that live in the Gulf. They are targeted for their swim bladders, which are sold on the black markets in Asia.

The rescue happened on February 19, when the crew of Sea Shepherd’s research vessel R/V Martin Sheen spotted the struggling humpback whale within the Vaquita Refuge in the Gulf at Baja California, Mexico.

The conservationists were actually at the site to protect the refuge’s namesake vaquita, which is a type of critically endangered porpoise from the northern part of the region. Its entire population numbers fewer than 100 individuals. Sea Shepherd’s effort to save this marine mammal has been dubbed “Operation Milagro.”

Breaching Humpback Whale Topples Kayakers

The vaquita can get caught in the illegal gillnets as bycatch, but in this case, it was a humpback whale that became a victim.

When the whale was spotted, Captain Oona Layolle — campaign leader and captain of the M/V Farley Mowat — notified the Mexican Navy and the Federal Attorney for Environmental Protection (PROFEPA). The crew then began the rescue operation of the female whale, which was estimated to be 35 feet long.

As the video shows, crews from both vessels worked to free the whale by cutting the gillnet off of her head and torso. Les Stroud, host of the TV show “Survirorman,” was also on board the M/V Farley Mowat and helped to free the whale.

Whales Hunting Under Northern Lights: Video

Right after the rescue, Stroud said, “This is true conservation in action. Today, we were able to save the whale and remove another illegal gillnet. It is an honor to be a crewmember with Sea Shepherd Conservation Society. Cutting that net and freeing the whale was a life changing experience.”

According to the organization, gillnets as well as longlines (lengthy lines with baited hooks attached at intervals) have trapped three totoabas, seven rays, another whale, and dozens of juvenile sharks in the region in just the past few weeks.