Women have more right to custody of children than men; in principle custody belongs to them, because they are more compassionate and more kind, and they know better how to raise small children, and they are more patient in dealing with the difficulties involved. The mother has more right to custody of her child, whether it is a boy or a girl, so long as she does not re-marry and so long as she meets the conditions of custody. This is according to scholarly consensus.
http://islamqa.info/en/ref/8189