The highly organized segment of the sperm flagellum which begins at the connecting piece and is characterized by the presence of 9 outer dense fibers (ODFs) that lie outside each of the 9 outer axonemal microtubule doublets and by a sheath of mitochondria that encloses the ODFs and the axoneme; the midpiece terminates about one-fourth of the way down the sperm flagellum at the annulus, which marks the beginning of the principal piece.