Without filing a petition for dissolution of marriage or legal separation of the parties, a spouse may bring an action for the exclusive custody of the children of the marriage. The court may, during the pendency of the action, or at the final hearing thereof, or afterwards, make such order regarding the support, care, custody, education, and control of the children of the marriage as may be just and in accordance with the natural rights of the parents and the best interest of the children. The order may be modified or terminated at any time thereafter as the natural rights of the parties and the best interest of the children may require.