What is the ruling on travel initially intended for sin if the intention changes to a permissible act?

Chapter on the Traveler's Prayer

Al-Mughni

Book of Prayer

Book 3 · Issue 2 · Bab 11

Open in Qurani

Primary text

If a person travels with the intention of committing a sin and subsequently changes that intention to a permissible purpose, the travel becomes permissible travel. Consequently, all concessions associated with permissible travel become applicable. The distance required for shortening prayers begins to be calculated from the moment the intention for the permissible act is formed.