Mesh deformed

Hi guys i have a problem with my low poly character the mesh deforms every time i try to raise its leg, and I cant really raise the leg whenever I tried to raised it higher its rotating . i tried to use weight painting and assigning faces to the bones but still the same, i am not sure if the problem is in IK or mesh or the rig please help! see screenshot

image

Hey there!
I can think of a few. Check that the poles are high so they donĀ“t interfere.

Allso, make sure that the rig have correct orientations.

Is the entire mesh scale 1:1?

Lastly, make sure the normals are not flipped.

Hope that helps!