A giant crocodile that today could only live in a universe of nightmares actually existed during prehistoric times, menacing Africa with the teeth of a Tyrannosaurus rex .

Scientists haven’t known much about the terrifying creature because they’ve only had some teeth and a jawbone to work with, but paleontologists have analyzed newly found fossils to learn more about it. In a study in the journal PeerJ, they say the bones show it was part of a group called crocodylomorpha, which includes modern crocodiles as well as many of their extinct relatives from the dinosaur era. The terrestrial monster is the oldest of its kind ever found, with the new bones dating back to the middle of the Jurassic Period — living between about 165 to 168 million years ago in Madagascar.

Read: R.I.P. to the Biggest Shark That Ever Lived

One of the predator’s defining characteristics is its teeth. Those huge, serrated teeth were shaped a lot like the T. rex ’s and “strongly suggest a diet that included hard tissue such as bone and tendon,” the study explains. And unlike crocodiles today, these prehistoric creatures walked around on erect limbs.

The species name Razanandrongobe sakalavae translates to “giant lizard ancestor from Sakalava region,” according to a report from the journal's publisher.

This enormous crocodile ancestor helps to understand their evolution. The crocodylomorpha fall within a group called the notosuchia, which lived during the Jurassic and subsequent Cretaceous Period, but scientists don’t know much about their early forms. The study says that they should have originated in the early Jurassic, but there isn’t a lot of hard data for their first 74 million years of life and evolution of the extinct animals.

Razanandrongobe is clearly a Jurassic notosuchian, and by far the oldest representative of the group, predating the other forms [previously discovered] by about 42 million years,” the study says. “Thus, it begins to fill the ghost lineage of notosuchians in the Jurassic.”

It may also be the biggest of its kind, with comparable specimens only appearing later on. That enormous size would have given it a great advantage.

Read: 3D Tech Reveals New Secrets In Old Dinosaur Fossils

“The large skull dimensions (and likely body size, too) reached by R. sakalavae , together with the peculiar feeding adaptations indicated by the dental and cranial features, suggest that this taxon was a highly specialized predatory crocodyliform of terrestrial habits, that could compete and occupy the ecological niches of theropod dinosaurs,” the study says. “Razanandrongobe sakalavae is the largest terrestrial carnivore from this Middle Jurassic terrestrial ecosystem and was perhaps one of the top predators in Madagascar at the time.”

As part of their research, which included an attempt to reconstruct the skull of the prehistoric crocodile, the paleontologists made CT scans of the fossils, which created 3D, layered images of the bones.