Child custody is determined by a judge according to the factors set forth in the statute. The applicable statute is Arizona Revised Statutes ยง25-403.
The factors the judge considers are the wishes of the parents and the child (if old enough to express a preference); the interaction of the child with the parents and siblings; the child's adjustment to home, school, and community; the mental and physical health of the parents and the child; which parent is more likely to allow frequent and meaningful contact with the other parent; which parent or parents have provided primary care of the child; and the nature and extent of coercion or duress used by a parent in obtaining an agreement for custody.