The oldest evidence of a fungus that turns ants into zombies and makes them stagger to their death has been uncovered by scientists.

The gruesome hallmark of the fungus's handiwork was found on the leaves of plants that grew in Messel, near Darmstadt in Germany, 48m years ago.

The finding shows that parasitic fungi evolved the ability to control the creatures they infect in the distant past, even before the rise of the Himalayas.

The fungus, which is alive and well in forests today, latches on to carpenter ants as they cross the forest floor before returning to their nests high in the canopy.

The fungus grows inside the ants and releases chemicals that affect their behaviour. Some ants leave the colony and wander off to find fresh leaves on their own, while others fall from their tree-top havens on to leaves nearer the ground.

The final stage of the parasitic death sentence is the most macabre. In their last hours, infected ants move towards the underside of the leaf they are on and lock their mandibles in a "death grip" around the central vein, immobilising themselves and locking the fungus in position.

"This can happen en masse. You can find whole graveyards with 20 or 30 ants in a square metre. Each time, they are on leaves that are a particular height off the ground and they have bitten into the main vein before dying," said David Hughes at Harvard University.

The fungus cannot grow high up in the canopy or on the forest floor, but infected ants often die on leaves midway between the two, where the humidity and temperature suit the fungus. Once an ant has died, the fungus sprouts from its head and produces a pod of spores, which are fired at night on to the forest floor, where they can infect other ants.

Scientists led by Hughes noticed that ants infected with the fungus, Ophiocordyceps unilateralis, bit into leaves with so much force they left a lasting mark. The holes created by their mandibles either side of the leaf vein are bordered by scar tissue, producing an unmistakable dumb-bell shape.

Writing in the journal, Biology Letters, the team describes how they trawled a database of images that document leaf damage by insects, fungi and other organisms. They found one image of a 48m-year-old leaf from the Messel pit that showed the distinctive "death grip" markings of an infected ant. At the time, the Messel area was thick with subtropical forests.

"We now present it as the first example of behavioural manipulation and probably the only one which can be found. In most cases, this kind of control is spectacular but ephemeral and doesn't leave any permanent trace," Hughes said.

"The question now is, what are the triggers that push a parasite not just to kill its host, but to take over its brain and muscles and then kill it."

He added: "Of all the parasitic organisms, only a few have evolved this trick of manipulating their host's behaviour.

Why go to the bother? Why are there not more of them?"

Scientists are not clear how the fungus controls the ants it infects, but know that the parasite releases alkaloid chemicals into the insect as it consumes it from the inside.

• This article was amended on 18 August 2010. A phrase in the original said: "This can happen on mass." This has been corrected.

• On 21 December 2010 the picture was rotated 180 degrees after readers pointed out that it shows an ant gripping the underside of a leaf.