A toxic drug fed to caged salmon in Scotland is due to be withdrawn from the market after scientists found that that it can leak into lochs and kill crabs, shrimps and lobsters.

Food pellets laced with a chemical called teflubenzuron have long been given to farmed salmon around the coast in order to control sea lice infestations. The lice eat salmon, killing them or stunting their growth, and can cause multi-million-pound losses for fish farmers.

But salmon excrete the chemical, which then pollutes the seabed around fish farms at levels than can be lethal to marine wildlife. Shellfish are poisoned and prevented from making new shells to protect them as they grow.

Now the Scottish Environment Protection Agency (Sepa) says it has persuaded the company that markets the drug to withdraw it. Campaigners, however, warn that replacement drugs could do just as much harm, and are demanding a much broader legal ban.

The latest research on teflubenzuron was conducted by scientists from the Institute of Marine Research and the National Institute of Nutrition and Seafood Research in Bergen, Norway. They detected high concentrations in sediment around a salmon farm on a fjord north of the city.

They estimated that it took 170 days for the teflubenzuron pollution to reduce by half, suggesting that it will persist in the marine environment for years. The drug was found in most of the wildlife they tested, including worms, crabs and fish.

In a study published in the journal, Science of The Total Environment, the researchers concluded that the levels in king crabs, shrimp and two species of lobster were high enough to kill them as they naturally shed and replace their shells. Teflubenzuron is designed to prevent animals from making chitin, a tough cellulose material vital for renewing shells.

Teflubenzuron has been regularly used on salmon farms in Scottish sea lochs along the west coast and on islands for years. According to Sepa, environmental quality standards for the drug were breached once in 2011, six times in 2012 and six times in 2013.

Pharmaq, the company that markets teflubenzuron under the brand name Calicide, confirmed that marketing in the UK "would be voluntarily stopped". The product's manufacturer, Skretting, said that it "will no longer be offered in Scotland pending further review with all stakeholders."

The Scottish Salmon Producers' Organisation, which represents the fish farm industry, said that teflubenzuron was "not an issue in salmon farming in Scotland today because it is so rarely used".

But this has failed to satisfy critics and wild fishing groups, who have long been concerned about the hazards of the toxins used in salmon farming. They are demanding an immediate statutory ban on teflubenzuron and other chemicals used to treat sea lice, and the complete containment of fish farms.

Guy Linley-Adams, the lawyer for for the Salmon and Trout Association's aquaculture campaign, warned that the next "chemical fix" for sea lice would also be likely to damage marine wildlife. "Fish-farming must be moved into closed containment, where sea-lice can be controlled without toxic chemicals being discharged into the wider environment," he said.

Don Staniford from the Global Alliance Against Industrial Aquaculture said: "You don't have to be a rocket scientist to understand that a chemical designed to kill sea lice also kills other crustaceans.

"Sepa should now ban all the other toxic chemicals used on salmon farms which kill shellfish. Teflubenzuron is just one of the lethal cocktail of chemicals used by Scotland's toxic salmon farming industry."

Sepa's aquaculture specialist, Douglas Sinclair, told the Sunday Herald: "Teflubenzuron has not been used by fish farms in Scotland since 2013. Sepa recently discussed the residues of teflubenzuron arising from the use of the medicine in Scotland with the company which markets the product. The company agreed to remove the product from the market in Scotland. Further use is therefore unlikely."

Fiona Matheson, secretary to Orkney Fisheries Association, which represents over 50 fishing vessels and processors, argued that teflubenzuron should be removed from the list of licenced fish farm drugs. "We need a stronger assurance than teflubnezuron's use may be unlikely," she said. "Its use should be legally ended."