Two floating cages from Scottish salmon farms have been transformed into a safe haven for the world’s rarest duck, which was driven to the brink of extinction by fish farming.

Twenty-one Madagascar pochards, an unobtrusive brown duck that for 15 years was believed to be extinct, have been released on to a lake in northern Madagascar.

The captive-bred ducks spent a week in the custom-made aviaries on Lake Sofia to encourage them to become accustomed to their new surroundings and make it their home. The ducks, which dive to find food, have also been trained to feed from submerged, floating feeding stations that only they can access.

Madagascar pochard ducklings at the floating aviaries at Lake Sofia, which serve as their temporary aquatic home. Photograph: Ben Sadd/WWT/PA

The pioneering reintroduction by the Wildfowl & Wetlands Trust (WWT), Durrell Wildlife Conservation Trust, the Peregrine Fund and the Madagascan government comes 12 years after the apparently extinct species was rediscovered by chance.

Lily-Arison Rene de Roland, the local director of the Peregrine Fund, was working on the conservation of another rare bird, the Madagascar harrier, when he spotted the duck on a remote crater lake high in the mountains. Tropical ducks are far less colourful than their northern counterparts because unpredictable weather means they need to be able to breed all year round and so the males do not acquire colourful feathers for annual mating rituals.

Ornithologists soon realised that the last surviving 25 or so ducks were breeding successfully, but their ducklings were never reaching maturity because the lake was too deep and cold for the young birds to survive and find food.

In 2009, Durrell, WWT and partners took one-day-old chicks from the lake to rear in captivity at a nearby breeding centre. The captive population has been painstakingly increased to 114 live birds today.

Members of the WWT conservation team releasing the Madagascar pochard ducklings at Lake Sofia. Photograph: Ben Sadd/WWT/PA

According to Glyn Young, Durrell’s head of birds, the pochard declined to the brink of extinction because non-native fish species were introduced to Madagascar wetlands for fish farming. “It looks as though introduced fish across Madagascar are largely responsible for the decline of the duck,” he said.

Carp released into the wetlands stirred up the water so the diving ducks could not find food so easily, and herbivorous fish such as tilapia stripped crucial vegetation from the lakes.

In 2017, Scottish salmon farming cages were converted into the world’s first floating pre-release aviaries and shipped from the UK to Madagascar, where they were assembled on Lake Sofia this spring. The first ducklings were transferred to shore-based aviaries in October, and moved into the floating aviaries in early December. They are now swimming freely on the lake.

It is hoped that the floating aviary and feeding stations will encourage the ducks to remain on Lake Sofia and breed. Conservationists have been working to ensure the habitat is more suitable than other lakes badly degraded by fish farming.

Conservationists said the support of the local community living around the lake – who depend on it for fish – had been vital to the project.

WWT’s head of conservation breeding, Nigel Jarrett, said: “Working with local communities to solve the issues which were driving this bird to extinction has been essential to giving the pochard a chance of survival.

“If we can make this work, it will provide a powerful example not just of how to save the planet’s most threatened species, but how communities can manage an ecosystem to benefit people and wildlife, especially in areas of significant poverty.”

Young added: “The restoration programme at Lake Sofia will encourage others in Madagascar to no longer look at the island’s wetlands as lost causes. They may once again be centres of biodiversity while continuing to support communities of people who have also come to depend on them.”