She does not have a guardian (wali), so the director of the Islamic centre did her marriage contract even though there is an Islamic judge (qaadi)
Question

I am a young man and I got married to a girl who was of illegitimate birth. The wali (guardian) who did my marriage contract with her was the director of one of the Islamic centres in the city where I live, because in our country there is no one in a position to be in charge of the Muslims’ affairs; rather there is an institute run by innovators, and they are the ones who do marriage contracts and have the authority to document marriages granted by our government to them, which is a democratic government; the government has given this institute permission to set up Islamic courts, which handle some cases according to Islamic law for which the government gives them permission. This girl was living in the same city where I live, as a seeker of knowledge, but she is not a resident there. When I wanted to marry her, she said that we should go to her city to do the marriage contract there, so we went with that director, but he is not the director of the centre where this girl was studying; rather he is the director of another centre. He did the marriage contract for me with her there. Is this marriage valid? Or should it have been done by the director of the centre in the girl’s city? Or should it have been done by someone from one of the centres in the girl’s city and not my city? Or should the wali have been the imam of a mosque and not a director? Or should the wali have been a director of that institute that is run by innovators? If the answer is that the marriage is invalid, what must I do?
Praise be to Allah.Firstly:
A girl of illegitimate birth does not have a wali from among her relatives because she does not have any relatives on her father’s side [‘asabah relatives].
In Kashshaaf al-Qinaa‘ (4/417) it says: The ‘asabah of one who has no [legitimate] father is the ‘asabah [male relatives] of his mother with regard to matters of inheritance only, as in the case where the sisters and daughters of the deceased are both regarded as ‘asabah. But the ‘aqabah (male relatives) of the mother are not required to give diyah (blood money) on his behalf, and they cannot act as guardians with regard to marriage, if the person of illegitimate birth is female, or act as guardians in other types of guardianship, such as guardianship with regard to wealth, because their connection to him is through the mother, which is a weak connection, and the fact that the connection through the mother may be based as ‘asabah in the case of inheritance does not mean that this connection may be regarded as ‘asabah with regard to other issues. End quote.
Secondly:
This girl’s marriage contract should be done by the qaadi (judge). If there is no qaadi, then it should be done by a Muslim man who has some status among the Muslims, such as the imam of the mosque or the director of the Islamic Centre.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: If it is not possible to find someone to act as a guardian with regard to the issue of marriage, then guardianship passes to the most suitable of those available who have some position of authority regarding issues other than marriage, such as the headman of the village, the leader of the caravan, and so on.
End quote from al-Ikhtiyaaraat, p. 350.
It says in Kashshaaf al-Qinaa‘ (5/52): If there is no guardian at all, such as if none of the types mentioned above are available, or her guardian unjustly refuses to agree to her marriage and there is no one else, then anyone who has some sort of authority in that place may do her marriage contract, such as the mayor or the most prominent figure of the city, or the leader of the caravan, and so on, because he has authority.
If there is no one with authority in that place, then a man of good character may do her marriage contract with her permission. Imam Ahmad said regarding the chief of a village: He may do the marriage contract of a woman who has no guardian, provided that he makes sure that the suitor is a good match and gives an appropriate mahr (dowry), if there is no qaadi in the area. That is because insisting on the condition of having a guardian for marriage in this situation is preventing marriage altogether, and that is not permissible, like stipulating that the guardian should be a male relative on the father’s side in the case of one who has no male relatives on her father’s side. End quote.
Based on that, you should have done the marriage contract in the Islamic court – whether in your city or in her city – even if it belonged to the organization set up by innovators, unless their innovation (bid‘ah) constituted disbelief (kufr).
If the director of the Islamic Centre in her city or your city did the marriage contract, then the marriage contract is valid, because of the comments quoted above from Shaykh al-Islam and others.
And Allah knows best.