Animal rescuers filmed the heart-warming moment an orangutan was given its first taste of freedom when it was released from a tiny wooden crate – its home for two years.

Kotap, aged just four, had spent half its life held prisoner in a dark box just one metre square in a remote Borneo village in West Kalimantan, Indonesia.

With only a plastic bottle for company, the ape was said to have known the outside world only through the sounds of people passing by and the occasional visit from the man who held him captive.

He was also said to have been fed an unhealthy human diet of bread, rice and sugary drinks.

Charity workers from International Animal Rescue (IAR) filmed the moment they arrived to free the orangutan from its crate in Rabak village on 13 April.

The animal was so frightened he could be seen retreating back into his box as the front hatch was opened.

"After years in the darkness, he clearly found the sight and sound of the outside world quite terrifying," the charity said.

A vet was eventually able to coax Kotap outside before carrying him to a nearby vehicle, where he was taken to the charity's rescue centre about a 10-hour drive away in Ketapang.

His captor, a man named Baco, was said to have been given the animal as a baby by some people he met in another village, who had been keeping the small ape in a cardboard box.

Baco – who said Kotap's favourite meal was uncooked instant noodles washed down with a sachet of sugary drink – built the wooden crate after becoming concerned the animal would disturb the neighbours, IAR said.

After initially refusing to give up the ape, Baco was eventually persuaded when conservation workers explained the plight of orangutans in Borneo and protection laws.

"This poor orangutan had been kept alone in the dark for two long years," Alan Knight, chief executive of IAR, said. "He was deprived of everything that an orangutan needs to survive in the wild.

"At four years old, he should still be with his mother, learning from her how to climb and move through the forest, what foods to eat and what to avoid, and how to build a nest in the trees to sleep in each night. Instead, Kotap lived a sad and solitary existence, unable to exercise or behave in any way like a wild orangutan. He was fed an unsuitable diet that could have made him seriously ill."

Knight said Kotap will now join other rescued orangutans at the charity's centre and be given a chance of returning to the forest.

Borneo's orangutan population has declined by more than 50% over the past 60 years to about 105,000, according to the World Wildlife Fund (WWF). They are classified as critically endangered by the conservation organisation.

It comes after a rare albino orangutan, thought to be five-years-old, was recently rescued from captivity in another remote village in the Indonesian part of Borneo.

Karmele Llano Sanchez, programme director of IAR, said: "It's high time people realised that, if they keep breaking the law by capturing orangutans and keeping or selling them as pets, then the species will soon become extinct.

"Anyone who is offered an orangutan should certainly not buy it. They should immediately contact the authorities and report the person trying to sell it. And if people are not willing to cooperate by surrendering the orangutan and persist in breaking the law, then the necessary action must be taken to enforce it."