Birds do it, bees do it ... and so did an early ancestor of humans that lived in Scotland 385 million years ago.

Scientists have traced the history of vertebrate sexual intercourse to an ancient armoured fish named Microbrachius dicki.

Microbrachius means "little arms" and refers to the genital limbs that locked male and female fish together when mating. And dicki, well...

The three inch long placoderm - a primitive armoured fish - frolicked in Scottish lakes millions of years before fins evolved into legs.

A study of Microbachius fossils revealed the first evidence of their primitive sexual organs.

To transfer sperm, males had grooved L-shaped claspers which were held in place by small paired bones on the female.

Lead scientist Professor John Long, from Flinders University in Adelaide, Australia, said: "Microbrachius means little arms but scientists have been baffled for centuries by what these bony paired arms were actually there for.

"We've solved this great mystery because they were there for mating, so that the male could position his claspers into the female genital area."

Similar copulatory claspers are seen today in some male sharks - but most present-day bony fishes fertilise eggs externally, outside their bodies.

The new discovery implies that external fertilisation evolved from internal fertilisation involving sexual intercourse, and not the other way around.

Microbrachius also seems to have made a head start in trying out interesting sexual positions. According to Prof Long, the fishes probably "did it" sideways.

"This enabled the males to manoeuvre their genital organs into the right position for mating," he said. "With their arms interlocked, these fish looked more like they are square dancing the do-se-do rather than mating."

The discovery, reported in Nature journal's online edition, highlights the importance of placoderms in vertebrate evolution.

"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, and that many of the features we have, such as jaws, teeth and paired limbs, first originated with this group of fishes," said Prof Long.

"Now, we reveal they gave us the intimate act of sexual intercourse as well."