Penis fencing is a mating behavior engaged in by many species of flatworm, such as Pseudobiceros hancockanus. Species which engage in the practice are hermaphroditic; each individual has both egg-producing ovaries and sperm-producing testes.
The flatworms "fence" using extendable two-headed dagger-like stylets. These stylets are pointed (and in some species hooked) in order to pierce their mate's epidermis and inject sperm into the haemocoel in an act known as intradermal hypodermic insemination, or traumatic insemination. Pairs can either compete, with only one individual transferring sperm to the other, or the pair can transfer sperm bilaterally. Both forms of sperm transfer can occur in the same species, depending on various factors.
One organism will inseminate the other, with the inseminating individual acting as the "father". The sperm is absorbed through pores or sometimes wounds in the skin from the partner's stylet, causing fertilization in the second, who becomes the "mother". The battle may last for up to an hour in some species.
Parturition, while necessary for successful offspring production, requires a considerable parental investment in time and energy, and according to Bateman's principle, almost always burdens the "mother". Thus, from an optimality model it is usually preferable for an organism to inseminate than to be inseminated. However, in many species that engage in this form of copulatory competition, each "father" will continue to fence with other partners until it is inseminated. In Alderia modesta, individuals will store sperm from several "fencing matches" before laying their eggs, and smaller individuals will more often inseminate a larger partner, with larger individuals spending more energy on laying eggs when paired with a smaller partner on the occasion that they transfer sperm unilaterally.