Copulation is the goal of the courtship process, crucial to reproductive success and evolutionary fitness. Identifying the circuitry underlying copulation is a necessary step towards understanding universal principles of circuit operation, and how circuit elements are recruited into the production of ordered action sequences. Here, we identify key sex-specific neurons that mediate copulation in Drosophila, and define a sexually dimorphic motor circuit in the male abdominal ganglion that mediates the action sequence of initiating and terminating copulation. This sexually dimorphic circuit composed of three neuronal classes - motor neurons, interneurons and mechanosensory neurons - controls the mechanics of copulation. By correlating the connectivity, function and activity of these neurons we have determined the logic for how this circuitry is coordinated to generate this male-specific behavior, and sets the stage for a circuit-level dissection of active sensing and modulation of copulatory behavior.