Three sharks have been rescued by the Royal Australian Navy after they were caught on abandoned longlines off the Northern Territory coast.

HMAS Huon, a "coastal minehunter", recovered five abandoned longlines up to three nautical miles inside the Australian Fishing Zone near the Ashmore Islands, more than 800 kilometres west of Darwin.

The longlines were believed to be from foreign fishing boats suspected of fishing north of Australian waters and had drifted into the Australian Fishing Zone.

Sharks targeted by foreign fishers are caught mostly for their fins, a valuable commodity in food markets in Asia.

Longlines are set either on the ocean floor or near the surface on the water with the surface longline buoyed by styrofoam or plastic floats.

Longlines can be tens of kilometres long and carry thousands of hooks.

Each of the five lines recovered by the HMAS Huon was about 400 meters in length with up to 25 hooks.

Two 1-1.5m tiger sharks and one three-metre oceanic whaler shark were cut free.

The ship's Diving Officer, Lieutenant Sam Mairs, said the crew - and an officer from the Australian Fisheries Management Authority (AFMA) who was onboard - jumped into action when the sharks were found to be alive and tangled in the line.

"Recovering the longlines can be hazardous due to their length and the number of sharp hooks attached," he said.

"The evolution normally requires 'all hands on deck' with the ship's company rotating through various positions.

"We try to move quickly in order to free any marine life trapped in the lines."

Sharks tangled 'from snout to tail'

Leading Seaman Brooke Callaghan said the procedure, overseen by AFMA officer Gavin Lovelock, was a team effort and rewarding for all involved.

"Some of the sharks were tangled in the line from their snout to their tail," Leading Seaman Callaghan said.

"Unfortunately, abandoned longlines can continue to trap fish and trap marine life and lead to these results.

"The experience really brought the team together, working as quickly as possible to free the sharks and there was a great sense of relief when they swam away.

"It was one of the most rewarding moments in my career and it was made even more special when a huge whale shark came up to the ship to have a sticky-beak."