Probably the only salient point in this case is the "wellbeing of the child" and I am almost certain that under Sharia the one over-riding issue that trumps everything else is whether he is being brought up as a convinced Muslim (and presumably, as far as Qatar is concerned, that means in the Wahabi tradition).

The religious perception of what happens to his soul trumps everything else and always will, as far as a religion-based legal system is concerned.

The Catholics used to kidnap Jewish children and keep them in an orphanage if a Catholic housemaid had performed a baptism ritual on them. It's the same thing, though eventually it did lead to an outcry in the West.