It starts from the pelvis and runs through the length of the femur while crossing the back of your knee. From there, it attaches itself to the tibia and fibula. Your hamstring muscle helps the knee to flex, while contracting it. The smaller function of the hamstring muscle is to span across your hip, which aids in its extension.