The Lord’s standard of morality commands that the sacred powers to beget life be protected and employed only between man and woman, husband and wife. To misuse this power is exceeded in seriousness only by the shedding of innocent blood and denying the Holy Ghost. If one transgresses the law, the doctrine of repentance teaches how to erase the effect of this transgression. As written in the Book of Mormon:
Yea, she did steal away the hearts of many; but this was no excuse for thee, my son. Thou shouldst have tended to the ministry wherewith thou wast entrusted.
Know ye not, my son, that these things are an abomination in the sight of the Lord; yea, most abominable above all sins save it be the shedding of innocent blood or denying the Holy Ghost?
For behold, if ye deny the Holy Ghost when it once has had place in you, and ye know that ye deny it, behold, this is a sin which is unpardonable; yea, and whosoever murdereth against the light and knowledge of God, it is not easy for him to obtain forgiveness; yea, I say unto you, my son, that it is not easy for him to obtain a forgiveness.
Source: Alma 39:4-6; The Book of Mormon: Another Testament of Jesus Christ