In the premortal Council in Heaven, our Heavenly Father presented His plan, which included the principle of agency. Lucifer rebelled and "sought to destroy the agency of man" (Moses 4:3). As a result, he and those who followed him were cast out. The rest of us chose Heavenly Father's plan, which allowed up to come to earth and gain a physical body. It also provided a Savior, Jesus Christ, who would atone for our sins. Through repentance we could be forgive. We shouted for joy! (see Job 38:7)
How we use the gift of agency in mortality affects our eternal happiness or misery. The scriptures teach us that "there is a law, irrevocably decreed in heaven..., upon which all blessings are predicated" (Doctrine & Covenants 130:20) — and to this law there is also "a punishment affixed" (Alma 42:22). Therefore, when we choose our course of action, we also choose the consequences of our actions (see Galatians 6:7). Although consequences may not be immediate, they will always follow. Choosing to follow God's commandments leads us toward peace and eternal life. Choosing to accept Satan's temptations leads us toward sin and heartache.
The Old Testament prophet Joshua set the example for us when he said, "Choose you this day whom ye will serve...but as for me and my house, we will serve the Lord." (Joshua 24:15)
taken from the Ensign Magazine, June 2010