Male bees use their midlegs to hold onto females while coupling. The legs also have brushes for grooming.
Also known as the mesothoracic leg, the midleg is the second pair of legs on the thorax of the bee. Changes in the midlegs of the bees are often a secondary sexual characteristic, affecting male bees and influencing their chances of finding a mate.
Modified midlegs are often used to hold onto the female as the bee mates with her. Many species mate in midair, so the ability to stay coupled together is important. Midlegs can also contain different coloured brushes and keels used for grooming.
This information is also available from the University of Calgary Invertebrate collection, where it was curated as part of a study on design inspired by bees.