Why was Jesus Christ baptized?

2 Nephi 31:4-9


2 Nephi 31:4-9
4. Wherefore, I would that ye should remember that I have spoken unto you concerning that prophet which the Lord showed unto me, that should baptize the Lamb of God, which should take away the sins of the world.
5. And now, if the Lamb of God, he being holy, should have need to be baptized by water, to fulfil all righteousness, O then, how much more need have we, being unholy, to be baptized, yea, even by water!
6. And now, I would ask of you, my beloved brethren, wherein the Lamb of God did fulfil all righteousness in being baptized by water?
7. Know ye not that he was holy? But notwithstanding he being holy, he showeth unto the children of men that, according to the flesh he humbleth himself before the Father, and witnesseth unto the Father that he would be obedient unto him in keeping his commandments.
8. Wherefore, after he was baptized with water the Holy Ghost descended upon him in the form of a dove.
9. And again, it showeth unto the children of men the straightness of the path, and the narrowness of the gate, by which they should enter, he having set the example before them.