Testicular torsion occurs when a testicle rotates, twisting the spermatic cord that brings blood to the scrotum. The reduced blood flow causes sudden and often severe pain and swelling. Testicular torsion usually requires emergency surgery. If treated quickly, the testicle can usually be saved. But when blood flow has been cut off for too long, a testicle might become so badly damaged that it has to be removed. If the latter occurs, sperm production will be affected.