Rescue crews from the Center of Coastal Studies successfully freed a humpback whale that was entangled in fishing line attached to a buoy off the coast of Gloucester.

Rescuers from the center's Provincetown base were dispatched to the whale's location around 8:30 a.m. Wednesday. A Massachusetts Environmental Police boat also responded.

A state Office of Energy and Environmental Affairs spokeswoman says the whale was 3.8 miles off the coast.

The whale was found attached to an orange buoy with fishing line wrapped around its body just below its head and flippers.

Crews in an inflatable vessel were able to cut the whale free. Officials say the rescuers couldn't get on top of the mammal without risking their own safety.

The whale swam away after it was freed around 8:00 p.m.