An Indian forest ranger was almost strangled by an 18-foot long python as he tried to pose for photos with it India. Sanjay Dutta and his team caught the python in Jalpaiguri after residents reported the snake had killed and eaten a goat and was near a school.

Dutta was able to capture the python with an animal-control pole, The Insider reported.

Before putting the snake in a sack and to transport it back to the wild, Dutta draped it around his neck and posed to take a selfie. However, the python started to tighten its grip around Dutta, almost strangling the ranger.

Dutta managed to escape the python’s grip. He said if he panicked, the python would have been more aggressive.

“I was not scared for even a moment, because had I panicked, it would have been fatal,” Dutta said.

After the incident, Dutta and his team released the python into the wild.