A viral video showing a gigantic python wrapping itself around an Indonesian villager has secured more than a million views, after locals wrestled with the serpent before successfully caging it.

The villagers initially thought the giant snake, which was resting by the river, was just an old log before one of them touched the serpent, triggering it into action.

The November 22 video, shot by villager Ronal Efendi Coto, shows the man fighting as others try to pry him loose from the python’s notorious death grip.

After calling for help and managing to subdue the serpent, the men put it into a cage in Pucuang Anam village in Sumatra and asked a local zoo for assistance.

But the zoo declined to take in the python, citing overcapacity.

“For now we are just keeping it in the cage so people can come and have a look”, Coto told AFP, adding that the snake was eight meters (26 feet) long.

Pythons are some of the largest snakes in the world, but are not known to measure more than seven meters in the wild.

In June, an Indonesian woman was found dead inside in the belly of a giant python after it was captured near where she vanished while tending her vegetable garden on Sulawesi island.