First... we should remember that there is both legal custody and physical custody. Many parents are concerned over physical custody as it is tied into child support; and many parents are concerned about legal custody, because shared legal custody is often given, unless one parent has shown he or she has issues in that area; CA law favors joint legal/physical if agreed upon, but the court has wide discretion for parenting and will consider the child or children's best interest.
Legal custody basically involves the health, welfare, education and safety issues involving raising of children. Attorney has seen many parents lose legal custody [prior to consulting attorney herein] due to very poor decisions made with kids (i.e. drunk driving, drug history, domestic violence, criminal actions, harming of kids, abandoning kids, etc.) As an example of "joint legal custody" in a form (by the CA Judicial Council, and used by all CA courts, see form FL341(E) online..)
It is potentially possible that one parent can poison the relationship between a parent and child to extent that the Court might have to award the other child to the other parent to prevent the same parental alienation from happening?
Family Code 3042 goes over a child's preference of where to live (one parent or another) and generally, gender, race, religion, sexual orientation or handicap supposedly are irrelevant to custody of children. If this was your partner being arrested, consider the difficulty at trial as to whether or not it would make a difference to your case?
So when your mediation results in a recommendation you do not like or want, did the mediator make informed decisions or did he or she ignore you and just listen to the other parent? It is very common to find out after the mediation that neither parent really understood what happened in the mediation itself. Not all mediators do the actual mediations exactly alike.
Attorney has found that many clients do not do well in mediation because they do not understand why they need to even go to mediation. Then they just blurt out anything they want to, may express high anger or no patience, and basically do not present well to the person that will decide their fate with the kids?
When considering whether one can lose custody to any of the named things listed in the title for this post, attorney has indeed seen parents lose custody for those things, in combination with many other things, most of which were negative. Negative things (smoking inside, falling asleep drunk, letting kids wander alone outside in front yard, giving kids alcohol or drugs, leaving kids alone home, allowing large animals with kids unsupervised, putting older kids in charge of younger kids while older kid is playing video games entire time, letting kids be truant, failing to take kids to doctor, ignoring kids' homework, etc.)
The reason that gender, race, religion and sexual orientation or handicap are not relevant to custody is because those items are already under Federal law protections, so it would be discriminatory. Note however, that if a parent was trying to get away with something by claiming it fell under one of those categories but in reality, it did NOT, that would be a different story.)
If you are facing mediation and need help, contact attorney.