Scientists have examined two fossils of rodent-like mammals that lived alongside dinosaurs in the Jurassic Period.

According to BBC News, the ancient mammals lived more than 160 million years ago, but still had a similar ecological diversity to that of modern mammals. The two animals were classified as mammaliaforms, which are extinct relatives of modern mammals.

One of them - Agilodocodon scansorius - made its home in trees, whereas the other - Docofosser brachydactylus - burrowed underground.

Both fossils were first discovered in China, but researchers at the Beijing Museum of Natural History teamed up with some from the University of Chicago to publish two papers in the journal Science.

"We consistently find with every new fossil that the earliest mammals were just as diverse in both feeding and locomotor adaptations as modern mammals," Zhe-Xi Luo, professor of organismal biology and anatomy at the University of Chicago and an author on both papers, said in a press release. "The groundwork for mammalian success today appears to have been laid long ago.

"We consistently find with every new fossil that the earliest mammals were just as diverse in both feeding and locomotor adaptations as modern mammals," Luo told BBC News. "These fossils help demonstrate that early mammals did indeed have a wide range of ecological diversity. It appears dinosaurs did not dominate the Mesozoic landscape as much as previously thought."

Since their discovery in 2013, the two fossils have been kept at the Beijing Museum of Natural History.

"The finger and limb bone dimensions of Agilodocodon match up with those of modern tree-dwellers, and its incisors are evidence it fed on plant sap," study co-author David Grossnickle, graduate student at the University of Chicago, said in the release. "It's amazing that these arboreal adaptions occurred so early in the history of mammals and shows that at least some extinct mammalian relatives exploited evolutionarily significant herbivorous niches, long before true mammals."