(a) In any proceeding where two or more parties seek custody of a child the court shall consider and evaluate all relevant factors in determining the best interests of the child, including the following factors:
(1) the wishes of the party or parties as to custody;
(2) the reasonable preference of the child, if the court deems the child to be of sufficient age to express preference;
(3) the child's primary caretaker;
(4) the intimacy of the relationship between each party and the child;
(5) the interaction and interrelationship of the child with a party or parties, siblings, and any other person who may significantly affect the child's best interests;
(6) the child's adjustment to home, school, and community;
(7) the length of time the child has lived in a stable, satisfactory environment and the desirability of maintaining continuity;
(8) the permanence, as a family unit, of the existing or proposed custodial home;
(9) the mental and physical health of all individuals involved; except that a disability, as defined in section 363A.03, of a proposed custodian or the child shall not be determinative of the custody of the child, unless the proposed custodial arrangement is not in the best interest of the child;
(10) the capacity and disposition of the parties to give the child love, affection, and guidance, and to continue educating and raising the child in the child's culture, religion, or creed, if any;
(11) the child's cultural background; and
(12) the effect on the child of the actions of an abuser, if related to domestic abuse as defined in section 518B.01, that has occurred between the parents or the parties.
The court may not use one factor to the exclusion of all others. The court must make detailed findings on each of the factors and explain how the factors led to its conclusions and to the determination of the best interests of the child.
(b) The fact that the parents of the child are not or were never married to each other shall not be determinative of the custody of the child.
(c) The court shall not consider conduct of a proposed custodian that does not affect the custodian's relationship to the child.
(d) The court shall consider evidence of a violation of section 609.507 in determining the best interests of the child.
(e) A person may seek custody of a child by filing a petition or motion pursuant to section 518.156.
(f) Section 518.619 applies to this section.