The hamstrings are muscles present on the back of the thigh. There are three muscles which are called the biceps femoris which rotates the leg laterally, the semitendinosus which is responsible for the medial rotation of the leg and the semimembranosus that is also responsible for the medial rotation of the leg.
These muscles are connected to bones in such a manner that their contraction leads to flexion of the knee joint and extension of the thigh. All of these muscles work synergistically. Complimenting one another during flexion of knee and extension of thigh. However, during the different rotations, each muscle has its own particular function which it is best at.
Biceps Femoris (lateral rotation of leg), Semitendinosus (medial rotation of leg), Semimembranosus (medial rotation of leg); **EACH HAMSTRING MUSCLE SHARES THE ACTION OF KNEE FLEXION AND EXTENSION OF THIGH**