# Legs twists after adding a pole target to IK [duplicate]

I just got finished adding IK to the leg bones of my model, but when I add a pole target the leg twists immediately, I tried fixing this by rotating the pole angle but this results in the IK not following the pole target as it should, I checked the axes of the bones to make sure everything was in order, and I could not find anything wrong what should I do?

The following img shows the before and after of attaching the pole target