A muslim man and woman had an affair and had an illegitamate child from that affair. The married woman took the child into her house and remained married to her husband. It was decided that the biological father would provide for his daughter and that she would live in the house of her mother and her mothers husband. The biological father became a very religious man and it is almost 20 years after this incident. She now lives in a house with her mother, her mother's husband and her older half-brother and half-sister.
Who is the wali of this girl? The biological father who provided for her for 20 years, the step-father, or her older half-brother who also lives with them?.
The scholars (may Allah have mercy on them) differed concerning the illegitimate child. Is he to be attributed to his zaani father or not? There are two opinions, which have been discussed in the answers to questions no. 33591 and 85043. The more correct view is that he should be attributed only to his mother and that he should not be attributed to the zaani.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said in Fataawa Islamiyyah (3/370): “With regard to the child who is born as a result of zina, he is the child of his mother, not of his father, because of the general meaning of the hadeeth in which the Prophet (peace and blessings of Allaah be upon him) said: ‘The child is to be attributed to the husband and the adulterer deserves nothing’ – i.e., this is not his child. This is what the hadeeth means. If the man marries her after repenting, then the child has been conceived before marriage and repentance and is not his child; he cannot inherit from the man who committed zina even if he claims him as his child, because he is not his legitimate child.” End quote.
Once it is established that the illegitimate child is not to be attributed to the zaani, then he has no ‘asbah [male relatives on the father's side].
It says in Asna’l-Mataalib (13/288): The illegitimate child has no ‘asbah because he is not attributed to the father. End quote from Tarqeem al-Shaamilah.
Some of the scholars are of the view that his ‘asbah with regard to inheritance is his mother, or his mother’s ‘asbah [male relatives on her father’s side]. With regard to guardianship for marriage and other matters, he has no ‘asbah.
It says in al-Iqnaa‘ (4/505): The ‘asbah of the illegitimate child is the ‘asbah of his mother with regard to inheritance only. … But they have no guardianship authority with regard to marriage or other matters. End quote.
Based on that, this girl does not have any guardian on the basis of blood ties, so her guardian is the Muslim ruler, because the Prophet (blessings and peace of Allah be upon him) said: “The ruler is the guardian of the one who has no guardian.” Narrated by Abu Dawood (2083) and al-Tirmidhi (1102); classed as saheeh by al-Albaani in Saheeh Abi Dawood.
If you are in a country where there is no Muslim ruler, then her guardian is the director of the Islamic Centre in her country; if there is no such person then it is the imam of the mosque.
For more information please see the answer to question no. 7989.
And Allah knows best.