Ref. No. 39 / 968
In the name of Allah the most Gracious the most Merciful
The answer to your question is as follows:
In the above mentioned case you are not obliged to do ghusl; only wadhu will be enough to perform namaz. You must abstain from waswasa.
And Allah know best
Darul Uloom Waqf Deoband