In piriformis syndrome, the sciatic nerve is compressed by the piriformis muscle in the posterior pelvis.