Establishing a child's paternity
Although genetic fingerprinting is used to determine filial relationship, it is established in Islamic law that the rules of maternity are based on the biological affiliation between a child and its mother, while paternity is determined by law. This means that any child born out of wedlock is not attributed to the fornicator though it is biologically attributed to its mother since she bore and gave birth to it. Accordingly, all the rules of maternity are established between the child and its mother such as those concerning inheritance, prohibition of marriage and so forth. A child's paternity is not established except within the confines of a valid marriage, an invalid marriage [in which one of the integrals or conditions of marriage is missing] or a mistaken intercourse which the person thinks is licit (an example of this is a mistaken belief of one's marital status). There is a scholarly consensus that paternity is not established in the absence of any of the above, this being the stance of Egyptian law.
In a paternity case, a judge must spare no effort to establish the paternity of a child. If it is made clear or proved to the court that a child was born into a valid marriage, paternity must be granted. In the absence of evidence proving a valid or an invalid marriage or mistaken intercourse, the court must not attribute the child to the man in question even if genetic fingerprinting proves he is the biological father. This is because paternity, as mentioned above, is based upon a legal relationship and not a biological one.
Allah Almighty knows best.