Millions of years before LSD and rock and roll, dinosaurs munched on psychedelic fungus, a new study suggests. The hints that dinos got high come from the first amber fossil ever found of ergot, a grass parasite that can have poisonous and mind-altering effects on animals that nibble the dark fungi.

Ergot provided the precursor to LSD (lysergic acid diethylamide). And people who eat ergot-contaminated rye (or other ergot-tainted grains) develop powerful muscle spasms and hallucinations. The phrase "St. Anthony's Fire" refers to both ergotism and the horrible burning feeling that ergot triggers by constricting blood vessels.

Now, it turns out that ergot has plagued grass-eaters since dinosaurs stomped the Earth. The hunk of amber from Myanmar encases an exquisitely preserved ergot fungus, perched atop a grass spikelet that grew about 100 million years ago, researchers report in the 2015 issue of the journal Palaeodiversity. The amber was excavated in a mine and collected by Joerg Wunderlich, a German paleontologist. [See Amazing Images of Ancient Organisms Stuck in Amber]

"This establishes for sure that grasses were in the Old World 100 million years ago," said lead study author George Poinar Jr., a zoology professor at Oregon State University.

Evidence is mounting that grasses evolved alongside the dinosaurs, rather than after the giant reptiles disappeared. Fossils suggest the first grasslands appeared some 30 million years after the mass extinction that killed off the dinos at the end of the Cretaceous Period about 65 million years ago. But even if grasses didn't spread widely early on, grasses discovered in dinosaur dung, and clues in pieces of amber, hint that grasses were around for creatures to graze on during the Cretaceous Period.

Fossilized dinosaur poop, known as coprolites, contains tiny cells found only in plants, several other studies have reported. The droppings are from sauropods, some of the largest plant-eating dinosaurs that ever lived.

No one knows when ergot fungus first attacked grass, but both fossils discovered inside the amber resemble modern species, Poinar said.

"It indicates that psychedelic compounds were present back in the Cretaceous," Poinar told Live Science. "What effect it had on animals is difficult to tell, but my feeling is dinosaurs definitely fed on this grass."

Researchers may also have to rethink the origins of ergot because of the new find. Earlier studies have suggested that ergot originated in South America toward the end of the Cretaceous Period, then migrated northward and spread to Europe and Africa. The amber fossils put the fungus firmly in the Old World, and the researchers suggested both grasses and their parasite were around since the older Jurassic Period, which lasted from about 199.6 million to 145.5 million years ago.

"Grasses probably go back to the Early Cretaceous Period and possibly even the Jurassic Period," Poinar said.

The amber relic is tiny — only about a half-inch long, and just about 0.2 inches wide and deep. The grass spikelet and ergot fungus resemble an ear of corn, with the leaves of grass wrapped around the "ear" of the dark, flowerlike fungus.

Amber is tree resin, and monkey puzzle trees (Araucaria) — the evergreen pines that looks like top-heavy Dr. Seuss trees — were the likely resin source, according to chemical tests and wood fibers found in amber from the same mine.

Editor's note: This story was updated to reflect that the amber was mined in Myanmar, not Malaysia.

Copyright 2015 LiveScience, a TechMediaNetwork company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.