Pudendal nerve. The pudendal nerve forms anteriorly to the lower part of the piriformis muscle from ventral divisions of S2 to S4 (Figs. 5.60 and 5.61). It: leaves the pelvic cavity through the greater sciatic foramen, inferior to the piriformis muscle, and enters the gluteal region; courses into the perineum by immediately passing around the sacrospinous ligament, where the ligament joins the ischial spine, and through the lesser sciatic foramen (this course takes the nerve out of the pelvic cavity, around the peripheral attachment of the pelvic floor, and into the perineum); is accompanied throughout its course by the internal pudendal vessels; and innervates skin and skeletal muscles of the perineum, including the external anal and external urethral sphincters.