On the Venn diagram of strange animal mating behaviors — from lobster golden showers to garter-snake orgies — duck sex is on the border between cartoonish and sadistic.

That’s right, our beloved mallards engage in some seriously disturbing mating behavior. The “dark side” of duck mating has its own chapter in the new book “The Evolution of Beauty: How Darwin’s Forgotten Theory of Mate Choice Shapes the Animal World — and Us” by Yale ornithology professor Richard O. Prum. It’s a controversial subject, earning notoriety in 2013 after news leaked that the federal government contributed $400,000 to study the mating habits of ducks — dubbed “duckpenisgate” by Mother Jones.

But Prum, recipient of a MacArthur “genius grant,” believes that understanding duck sex might better help us understand evolution. And it all begins with the duck penis.

Ducks, for one, are outliers within the avian population. Unlike 97 percent of birds, ducks have penises — super-long ones. They are among the best endowed (in terms of ratio of body to member) of all vertebrates. For example, the 1-pound, foot-long Argentinian lake duck has the longest of all with a member that is 4 inches longer than its body.

Duck penises regrow every mating season. Once the season ends, the penis begins to shrink and regress until it’s 10 percent of its full-grown size. They are stored inside the duck’s body, waiting to emerge only during copulation. “The process generally resembles a cross between using your arm to evert a sweater sleeve that is inside out and unfurling the soft, motorized roof of a convertible sports car with a hydraulic drive,” writes Prum.

And it only gets weirder.

The duck penis is not straight, but spirals counterclockwise (!) from its base to its tip. The Muscovy duck penis completes six to 10 full twists over its 20-centimeter (7.8-inch) length.

“Like a selection of sex toys from a vending machine in a strange alien bar,” writes Prum, “duck penises come in ribbed, ridged and even toothy varieties” to hook into a female’s reproductive tract, which is as long and convoluted as the penis.

Female reproductive tracts are full of twists and turns or, as Prum puts it, “dead-end side pockets or cul-de-sacs,” and some spiral clockwise in the “opposite direction of the counter-clockwise spiraling duck penis.”

Here’s where evolutionary biology and mate selection comes in — and where the story gets dark. Many duck species skew male, meaning females can be pickier in their choice of mate. For a male duck to land a female, he must boast colorful plumage plus have an elaborate dance mating ritual and beautiful mating calls. In other words, he needs to be a beauty, plus a great singer and dancer.

Most males don’t measure up. So what’s a mediocre guy to do?

Forced copulations are “pervasively common in many species of ducks,” writes Prum. These are socially organized “gang rapes” that are “violent, ugly, dangerous and even deadly” and even sometimes end in the death of the female.

This represents a “selfish male evolutionary strategy that is at odds with the evolutionary interests of its female victims and possibly with the evolutionary interests of the entire species,” Prum writes. To spread their seed, these ducks are upsetting the natural order of selection.

But the females have mounted their own defense with an increasingly elaborate anatomy — including, in some cases, sharp turns in her reproductive canal that act almost as teeth, making it harder for ducks to inseminate during forced copulations.

‘Like a selection of sex toys from a vending machine in a strange alien bar, duck penises come in ribbed, ridged and even toothy varieties.’

“Male ducks had evolved penises that would enable them to force their way into an unwilling female’s vagina, and the females in turn had evolved a new way — an anatomical mechanism — to counter the action of the explosive corkscrew erections of male ducks and prevent the males from fertilizing their eggs by force,” writes Plum.

This helps explain why duck vaginas are so elaborate and why duck penises have evolved to keep up — a kind of sexual evolution arms race called antagonistic coevolution.

It’s pretty depressing to know how those ducklings are made. But it’s not all bad, Prum adds. Some ducks and most birds have called off the arms race and dispensed with a penis entirely — no more forced copulations, no more elaborate reproductive tracts.

Instead, female and penis-less male birds rub their cloaca (openings that house testes or ovaries) together in what’s called a “cloacal kiss” — an act that shows the power of natural selection. And how both beauty and brutality guide evolution.