An ancient species of fish, which existed in Scotland about 385 million years ago, invented sexual intercourse, according to a new study that said it is “one of the biggest discoveries in the evolutionary history of sexual reproduction.” The ancient fish, which are believed to be the earliest vertebrate ancestors of humans, also existed in parts of Estonia and China.

The prehistoric armored fish, called “placoderms,” used to switch their sexual practices from internal to external fertilization, an act previously thought to be evolutionarily unlikely. The scientists showed in the study, published in the Journal Nature on Monday, that males of the “Microbrachius dicki,” which belonged to the antiarch group of placoderms, developed bony L-shaped genital limbs called claspers to transfer sperm to females.

“It was previously thought that reproduction spawned externally in water, and much later down the track in the history of vertebrate evolution,” John Long, a professor at Flinders University in Adelaide, Australia, and the study’s lead author, said in a statement. “Basically it’s the first branch off the evolutionary tree where these reproductive strategies started.”

According to the scientists, the oldest bony fishes that follow placoderms in the evolutionary tree did not show evidence of internal fertilization, suggesting that these early fish must have lost the internal fertilization method before some of their successors re-invented organs with a similar function, Nature reported.

The new study is also expected to make a significant contribution to an ongoing debate about placoderms’ place in evolutionary history. According to scientists, other vertebrates likely shared a common ancestor with this ancient group of fish, which was considered to be an “evolutionary dead end.”

“Placoderms were once thought to be a dead-end group with no live relatives but recent studies show that our own evolution is deeply rooted in placoderms… Now, we reveal they gave us the intimate act of sexual intercourse as well,” Long said.

Here is an animation, portraying the copulation, described in the study: