A man was arrested Friday and charged with child endangerment and trespassing in a zoo enclosure after he brought his child inside the San Diego Zoo’s elephant habitat, NBC News reports.

San Diego Zoo Wildlife Alliance spokesman Andrew James explained in a statement that, “despite multiple barriers,” the unidentified father “purposely and illegally trespassed into a habitat.” A witness named Matthew Passiglia told NBC 7 San Diego that he was in a nearby cafe when he saw the man and his toddler moving past the barriers in an effort to take a photo. 

Passiglia said that within 30 seconds of their illegal entry, the elephant noticed them. “It was a big roar. [The elephant] stuck its head up in the air and its tusks and he started trotting toward them,” he recalls. The man tried to escape and during his attempt to flee, he allegedly tripped and dropped his child. He was still able to pick the toddler up and narrowly dodge a much more deadly circumstance as the elephant was charging in his direction. 

Passiglia claims the elephant came within five feet. “I didn’t think it was going to end well,” he remembers. “There was a moment when the elephant had the option and luckily the elephant took a second guess and there was confusion right there on the floor with them.” Before reaching the fencing, which was pierced by the elephant’s tusks, the man managed to hand off his child to one of the onlookers who was trying to help before getting past the enclosure himself. 

No injuries were sustained. The San Diego Police Department is investigating the incident.