Buying property from a person who purchased property through GPA

Hello, I am going to buy a house from a person. At the moment Person X is the holder of the property and online Encumbrance Certificate reflects the same. Even Bank of Baroda is willing to give me home loan for the property after their legal verification. Please help me with the legalities. :-) Person X is selling me the property (house). This house is bought by person X via a GPA purchase from person M. Person M is the mother of the original holder and is the GPA agent. When the Person X bought the property, GPA principal is alive & still is. GPA is registered in the registrar office. Post the property is registered to Person X, the GPA principal filed a case against both Person M and person X that the registration is invalid. But the records at the registration office still mentions that the GPA is valid at the time of registration. So far there is no ingestion order on the property and registration office shows clean records. Now the Person X wants to sell me the property as he is moving abroad permanently. Given the context, what advice will you give me about purchasing the property. Person X is my close friend and I want to help him with this purchase for financial reasons. Let me know what legal procedures I have to take.