Media playback is unsupported on your device Media caption The arrival of the new baby gibbon provides hope for the future of this endangered species

Conservationists are celebrating the arrival of a baby Javan gibbon - the first of this species to be born in the wild to parents that were rescued from the pet trade.

Conservation International says the birth is a boost for the future of the apes on the Indonesian island of Java.

But illegal trade is still a threat, and is increasingly moving online.

A UK-based investigation this year revealed that the law protecting these ape species was being openly "flouted".

Researchers who carried out the investigation, who are based at Oxford Brookes University, also showed BBC News videos of protected species being advertised by pet traders on social media platforms.

Learning to be wild

The birth of the wild-born Javan gibbon - in a protected forest in West Java - is a breakthrough for a project that has now released 17 of the apes into the area.

Conservation International (CI) and the Javan Gibbon Foundation have rehabilitated the animals, and rangers now patrol the site at Mount Malabar daily, monitoring the animals and checking for any poaching activity.

It has taken almost 10 years to bring the two adults back to the forest.

"It's a long, long process," explained Anton Ario from CI. "Because the poachers that take gibbons for the trade target the babies - because they're cute and easy to sell - when we find them, they're often living in a cage and cannot move around at all. They need to learn to live in the trees."

To ensure their rereleased animals are able to survive, they introduce them to potential mates while they are still in captivity - ultimately releasing pairs or family groups of the animals.

The new birth represents hope for a primate that is rapidly losing its habitat in Java, which has less than 5% of pristine forest left in its steep, tropical mountains.

But while programmes like this can get a few animals back to the wild every year, many more are being bought and sold as pets.

Ape for sale

Image copyright TRAFFIC Image caption Young orangutans are targeted by the illegal pet trade

A search on social media channels will reveal pet shops and sellers - many based in South East Asia - openly advertising pet baby gibbons for sale.

"They are flouting the law," says Prof Vincent Nijman, from Oxford Brookes University, who has carried out investigations of the illegal trade in endangered apes.

Image copyright other Image caption Researchers monitoring the trade showed us pictures and videos of gibbons being advertised for sale on social media platforms, including Facebook and Instagram

"No-one is being punished.

"So if people [entering the forest] come across a baby gibbon and have the option to capture it, they are motivated to do it. It represents money and doesn't represent any risk."

The trade is not confined to gibbons. Critically endangered orangutans and slow lorises are also being "plucked" from the wild.

Prof Nijman's recently published investigation revealed that, while more than 400 illegal pet orangutans had been seized by law enforcement in Indonesia in the last two decades, those confiscations had led to only seven prosecutions.

Image caption Rescued apes have to be rehabilitated by conservationists, who help them learn to return to the trees after life in a cage

BBC News reported a post to Facebook that advertised a baby gibbon for sale. In response, the company said it had removed the post and was "investigating the page where it was posted".

"We're committed to helping tackle the illegal online trade of protected wildlife and will remove any content that violates our community standards when it is reported to us," Facebook said in a statement.

Instagram has also responded after the BBC alerted it to the sale of gibbons on the site. In a statement sent to BBC News, the company said that the accounts in question had been removed, adding that the illegal trade or sale of animals was "prohibited on Instagram".

Prof Nijman pointed out that the numerous threats to endangered apes in Indonesia were not all problems that people had the power to tackle.

"Orangutans in particular face threats left, right and centre," he said, "But curbing the pet trade is within our control.

"It's in human hands to fix this."

Watch our full investigation into the trade in wild animals and birds in Indonesia in Our World: Songbirds for Sale on BBC Iplayer

Follow Victoria on Twitter