A dog survived a terrifying encounter with a gorilla after it wandering into an enclosure at the San Diego Zoo Safari Park.

The incident took place Sunday after two dogs were reported to be loose in the park. Around 4 p.m. local time, a male shepherd managed to jump into the gorillas’ habitat.

Once Zoo visitors noticed the dog, they attempted to help the distressed canine as they waited for park officials to arrive.

In a video shared on social media, the dog can be seen wandering around the closure before being chased by the gorilla. The dog attempts to hide in the enclosure while the curious gorilla approaches him.

At one point in the video, the dog can be seen jumping off of a grassy area to get away from the primate. Some bystanders can also be heard calling the gorilla’s name to distract it from going after the frightened dog.

Once zoo workers became aware of the situation, the gorillas were removed from their outdoor habitat. Around 6:30 p.m., three officers from the San Diego Humane Society arrived after receiving calls about the dog trapped in the enclosure.

“As soon as zoo staff saw the dog, they moved the gorillas out,” the SD Humane Society stated. “Our Humane Officers were able to move in and safely leash the shepherd and bring him back to our Escondido Campus for evaluation.”

San Diego Zoo Safari Park later told a local outlet the dog was removed from the exhibit and that no animals or people were harmed by the incident.

“Wildlife care specialists successfully recalled the two gorillas out of the habitat so the dog could be removed,” the safari park said in a statement. “Recall training is a part of the regular safety procedures at the Park.”

Since the dog did not have a microchip, he will be placed on a stray hold as officials work to track down its owner.

A silverback mountain gorilla from the Muhoza family sits in Rwanda's Volcanoes National Park
A silverback mountain gorilla from the Muhoza family sits in Rwanda's Volcanoes National Park AFP / Simon MAINA