A separation or divorce may not be granted unless the plaintiff in good faith has been a resident of the state for six months next preceding commencement of the action. If the plaintiff has not been a resident of this state for the six months preceding commencement of the action, a separation or divorce may be granted if the plaintiff in good faith has been a resident of this state for the six months immediately preceding entry of the decree of separation or divorce.
N.D.C.C. ยง 14-05-17