Imam As Saa’adi said regarding the movements in the prayer, categorizing them into four:

1. That which nullifies the prayer: and it is continuous movements without any need for it.

2. That which is disliked: and it is little movements without a need.

3. That which is neither disliked or recommended: and it is little movements due to a need.

4. That which is recommended or could be obligatory: and it is that which is for the benefit of the prayer, or to do something which is commanded such as the front row moving back and the back row moving forward during the prayer of fear, or to rescue someone, or similar to that

[Sharh Umdatul Ahkaam Pg. 128]

Translated by

Majid Jawed Al-Afghanee
Abu Layl