The levator ani muscles help support the pelvic viscera and maintain closure of the rectum and vagina. They are innervated directly by branches from the anterior ramus of S4 and by branches of the pudendal nerve (S2 to S4).