When introducing the promise land to Israelites, the Lord explains in Deuteronomy 11:26-28 that the gift of the promise land comes with a big condition.
Behold, I set before you this day a blessing and a curse; A blessing, if ye obey the commandments of the Lord your God, which I command you this day: And a curse, if ye will not obey the commandments of the Lord your God, but turn aside out of the way which I command you this day, to go after other gods, which ye have not known.
Joshua reminded the Israelites of this promise shortly before leading them into the promised land. (Joshua 24:14-15)
Now therefore fear the Lord, and serve him in sincerity and in truth: and put away the gods which your fathers served on the other side of the flood, and in Egypt; and serve ye the Lord. And if it seem evil unto you to serve the Lord, choose you this day whom ye will serve; whether the gods which your fathers served that were on the other side of the flood, or the gods of the Amorites, in whose land ye dwell: but as for me and my house, we will serve the Lord.
The Old Testament is full of examples of how the Israelites forgot to serve the Lord and suffered as a nation. They were only allowed to live free when they choose to follow the commandments.
The same cycle is repeated in the Book of Mormon. In Ether 2:12 Mormon warns those living in America that they have an obligation to serve Jesus Christ to maintain their freedom.
Behold, this is a choice land, and whatsoever nation shall possess it shall be free from bondage, and from captivity, and from all other nations under heaven, if they will but serve the God of the land, who is Jesus Christ, who hath been manifested by the things which we have written.
Notice how similar that promise is to the promise given to the Israelites. In 2 Nephi 2:27 we are reminded that we a free to choose freedom or captivity.
Wherefore, men are free according to the flesh; and all things are given them which are expedient unto man. And they are free to choose liberty and eternal life, through the great Mediator of all men, or to choose captivity and death, according to the captivity and power of the devil; for he seeketh that all men might be miserable like unto himself.
So today as we celebrate our country’s freedom we need to remember that our freedoms are a blessing that must be earned through obedience to the Gospel of Jesus Christ. Anyone that says otherwise does not understand our history and is leading us to destruction.