A Kenyan man bit a python who wrapped him in its coils and hauled him up a tree in a struggle that lasted hours, local media said Wednesday.

Farm manager Ben Nyaumbe was working at the weekend when the serpent, apparently hunting for livestock, struck in the Malindi area of Kenya’s Indian Ocean coast.

“I stepped on a spongy thing on the ground and suddenly my leg was entangled with the body of a huge python,” he told the Daily Nation newspaper.

When the snake coiled itself round his upper body, Nyaumbe resorted to desperate measures: “I had to bite it.”

The python dragged him up a tree, but when it eased its grip, Nyaumbe said he was able to take a mobile phone out of his pocket and phone for help.

When his supervisor came with a policeman, Nyaumbe smothered the snake’s head with his shirt, while the rescuers tied it with a rope and pulled.

“We both came down, landing with a thud,” said Nyaumbe, who survived with damaged lips and bruising.

The snake escaped from the three sacks it was bundled into.