Who has the greater right to raise the child
Question: If someone loses the one who raises him, can the one who is a guardian in the absolute sense become the guardian for his upbringing?
Answer: When the one entitled to upbringing is lost, or some obstacle arises that prevents him from raising the child, then whoever comes after him in rank among those responsible for upbringing should take over this responsibility and should also carry out the work that the former used to carry out. The jurists have stated this explicitly.
It is in “Sharh Kabir”:
“If the father or another caretaker is no longer present and there is an ‘asabah (male agnatic relative) present, such as a brother, a paternal uncle, or a paternal uncle’s son, then he takes the place of the father. Then the ruler gives the child the choice between him, that ‘asabah, and the mother, because Ali (may Allah be pleased with him) gave ‘Umarah al-Khuramiyy the choice to choose either his paternal uncle or his mother, since his paternal uncle was his ‘asabah and was therefore similar to the father. Likewise, if the mother or another one of those qualified for hadanah (custody and upbringing) is absent and the grandmother has raised him, the boy is given the choice to choose her, or the father, or whichever of the ‘asabah takes his place. If both the mother and the father are absent, or none of those qualified for hadanah is present, then he is handed over to his sister, paternal aunt, or maternal aunt, and she takes the place of his mother in choosing one of the two, as mentioned, just as, if the father or any of those qualified for hadanah is absent and an ‘asabah is present, the ruler orders that a choice be made between the ‘asabah and the mother.”
The same is mentioned in the commentary on “al-Iqna'” and “Muntaha” as is in “Sharh Kabir”.