What is the ruling on intentionally moving forward when required to return in prayer, or returning when required to move forward?

Chapter on the Two Prostrations of Forgetfulness

Al-Mughni

Book of Prayer

Book 3 · Issue 1 · Bab 7

Open in Qurani

Primary text

If one intentionally proceeds in a place where returning is obligatory, or returns where proceeding is obligatory, while knowing the prohibition of that action, the prayer is invalidated because a required element was deliberately abandoned during the prayer.

Supporting text

If this action is done while believing it permissible, the prayer is not invalidated because the abandonment was not deliberate; this is analogous to proceeding before recalling an omitted element.