The court considers various factors, including the child’s wishes (if they are of an appropriate age), the child’s relationship with each parent, the capacity of each parent to care for the child, and any history of family violence or child abuse. The court must always prioritize the best interest of the child.