(a) If two or more parties seek custody of a child, the court must 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, subdivision 12, 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 interests 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 and 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, subdivision 2, that has occurred between the parents or the parties.
(b) 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.
(c) The court must not give preference to a party over the de facto custodian or interested third party solely because the party is a parent of the child.
(d) The court must not prefer a parent over the de facto custodian or third party custodian solely on the basis of the gender of the parent, de facto custodian, or third party.
(e) The fact that the parents of the child are not or were never married to each other must not be determinative of the custody of the child.
(f) The court must consider evidence of a violation of section 609.507 in determining the best interests of the child.
(g) The court must not consider conduct of a proposed custodian that does not affect the custodian's relationship to the child.
(h) Section 518.619 applies to actions under this section.
(a) In addition to the factors listed in subdivision 1, if either joint legal or joint physical custody is contemplated or sought, the court must consider the following relevant factors:
(1) the ability of the parties to cooperate in the rearing of the child;
(2) methods for resolving disputes regarding any major decision concerning the life of the child and the parties' willingness to use those methods;
(3) whether it would be detrimental to the child if one party were to have sole authority over the child's upbringing; and
(4) whether domestic abuse, as defined in section 518B.01, subdivision 2, has occurred between the parties.
(b) If the court awards joint legal or physical custody over the objection of a party, the court must make detailed findings on each of the factors in this subdivision and explain how the factors led to its determination that joint custody would be in the best interests of the child.