Scientists have long wondered where in the sea these extinct fish groups and their living relatives first evolved. Was it the open ocean? Perhaps on coral reefs? Or maybe in the depths of the abyss?

Figuring out the answer has been difficult. While there’s an abundance of fish fossils from about 420 million years ago, the ancient fossil record gets scarce farther back at about 480 million years ago, when fish are believed to have first appeared.

Now, a new study suggests that fish first swam in the shallows around the coasts of supercontinents before they diversified and conquered the world’s waters. The findings, which were published Thursday in the journal Science, also provide insight into the origins of the vertebrates that became the forebears of our ancestors who first ventured onto land.

[Like the Science Times page on Facebook. | Sign up for the Science Times newsletter.]

To better understand the ancient evolutionary history of fish, the researchers trawled through the scientific literature and created a database with more than 2,700 fossil records of jawed and jawless fish from every continent that stretched from 480 million to 360 million years ago. The database allowed the team to determine where in the ocean the ancient fish groups lived and evolved.