A petition to release the caged mammals had gathered more than 1.5 million signatures.

Authorities in Russia have agreed to free almost 100 whales held in cramped enclosures in the country’s far east for almost a year, according to officials.

The decision on Monday to release the 10 orcas and 87 beluga whales came after international scientists, including renowned oceanographer Jean-Michel Cousteau, signed a joint agreement with Russian scientists backed by local authorities, to free the trapped Mammals.

“A decision in principle has been taken to release all the animals into the wild,” Oleg Kozhemyako, the governor of Primorsky Region, told reporters after the signing ceremony.

“Scientists from Cousteau’s team and Russian scientists will decide when and which animals to release.”

Images of the mammals, kept in enclosures in a bay near the Sea of Japan port of Nakhodka, first appeared after they were caught last summer by firms which planned to sell them to marine parks or aquariums in China.

Their plight angered animal rights groups and spurred a petition to release the whales, shared by Hollywood star Leonardo DiCaprio on social media, which gathered almost 1.5 million signatures online. Actress Pamela Anderson also posted an open letter to Russian President Vladimir Putin on her website.

The Kremlin intervened and ordered local authorities to act, prompting Russia’s FSB security service to bring charges against four companies for breaking fishing laws.

But although the Kremlin agreed that the whales were held in cruel conditions, it said it was difficult to release them into the wild without harming them.

As such, a special rehabilitation facility for whales would be set up under the agreement, with conditions as close as possible to their natural environment.

Cousteau told reporters it was a very emotional moment for him and the scientists would do all they could to save the animals.

“I know it’s a lot of work, but I have no doubt that we are going to succeed,” said Cousteau.

The scientists promised they would devise a plan to release the whales.

The Kremlin has said Russia has no direct ban on catching whales, but they can only legally be caught in specific circumstances, for scientific and educational purposes.