Answer
The excessive movement that invalidates the prayer is what the observer knows to be done by a non-praying person. As for the minimal movement, which is the opposite of excessive, it is excused and does not invalidate the prayer; because its origin cannot be avoided; since in a living person there are movements that are not part of the prayer by nature, so it is excused as long as it is not excessive and does not reach the limit of what can be avoided. For this reason, both intentional and forgetful actions are treated equally in this regard; as narrated by Abu Qatadah, may Allah be pleased with him: "Indeed, the Messenger of Allah, peace be upon him, was praying while carrying Umamah bint Zainab, the daughter of the Messenger of Allah, peace be upon him, and Abu al-As ibn al-Rabi. When he stood, he would carry her, and when he prostrated, he would place her down," in Sahih Muslim 1: 385, and Sahih al-Bukhari 1: 193. And from Aisha, may Allah be pleased with her, she said: "I used to sleep in front of the Messenger of Allah, peace be upon him, with my legs towards his Qiblah, and when he prostrated, he would nudge me, so I would fold my legs, and when he stood, I would extend them," in Sahih al-Bukhari 1: 192, and Sahih Muslim 1: 367. The nudge is the touch or squeeze with the tips of the fingers. See: Sharh al-Wiqayah p. 159-161, and Tabyin al-Haqaiq 1: 159-162.