The World Federation One Stop Fiqh

Ruling 385

If due to shortage of time one’s duty was to perform tayammum but thinking that he had enough time to perform both ghusl and the prayer, he performed ghusl instead and his prayers became qaḍāʾ [i.e. they were not performed in their prescribed time], then in case he had performed ghusl with the intention of attaining proximity to Allah, his ghusl is valid even if he had performed the ghusl in order to perform prayers.