Minn. Stat. § 518.18
(d) If the court has jurisdiction to determine child custody matters, the court shall not modify a prior custody order unless it finds, upon the basis of facts, including unwarranted denial of, or interference with, a duly established visitation schedule, that have arisen since the prior order or that were unknown to the court at the time of the prior order, that a change has occurred in the circumstances of the child or the parties and that the modification is necessary to serve the best interests of the child. In applying these standards the court shall retain the custody arrangement established by the prior order unless:
(iii) the child's present environment endangers the child's physical or emotional health or impairs the child's emotional development and the harm likely to be caused by a change of environment is outweighed by the advantage of a change to the child.
In addition, a court may modify a custody order under section 631.52.