All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
In principle, writing a will about the custody of the children is the right of the father, because it is the father who is the guardian of his children when he is still alive. So he has the right to appoint an agent who would take care of his children after his death.
However, the mother is not permitted to appoint a guardian for her children because she is not the guardian of her children when she is still alive so she has no right to appoint someone to be a guardian of her children if she dies. Some scholars reported that the jurists agreed on the above rulings. This is, of course, if the parents are following and believing in one religion [i.e. Islam].
However, if the mother embraces Islam, for instance, while the father remains as a non-Muslim, then he has no right in the guardianship of the children.
This is because these children are judged to be Muslims following the religion of their mother who is upon the better religion because a non-Muslim is not entitled to be a guardian of a Muslim.
In such a case, the mother can take the matter to the Muslim judge or to the considerable bodies who can act on his behalf, like Islamic Centers and the like so that they would appoint a guardian for the children.
Allaah Knows best.