If the parents agree who is to have custody, the court shall award custody in accordance with their agreement unless the provisions of R.S. 9:364 apply or the best interest of the child requires a different award. Subject to the provisions of R.S. 9:364, in the absence of agreement, or if the agreement is not in the best interest of the child, the court shall award custody to the parents jointly; however, if custody in one parent is shown by clear and convincing evidence to serve the best interest of the child, the court shall award custody to that parent.