When Joshua was leading Israel into the promise land, He and all Israel had a lesson to learn in the Holiness of God. It begins with this encounter:
13 Now when Joshua was near Jericho, he looked up and saw a man standing in front of him with a drawn sword in his hand. Joshua went up to him and asked, "Are you for us or for our enemies?"
14 "Neither," he replied, "but as commander of the army of the LORD I have now come."
Then Joshua fell facedown to the ground in reverence, and asked him, "What message does my Lord have for his servant?"
15 The commander of the LORD's army replied, "Take off your sandals, for the place where you are standing is holy." And Joshua did so. (Joshua 5:13-15)
This angelic messenger (I don't know what else to call him), doesn't respond as we might expect. Joshua's question, "Are you for us or for our enemies?" seems to warrant the answer, “Of course I am for you, because God is going to deliver the inhabitants of the land into your hands, just as He promised.” Instead he essentially says, “Neither... I am not here for your interests, or your enemies interests, but to protect the interests of the Lord.”
The last time I remember such a sword drawn messenger of the Lord was when Balaam and his donkey were on their way to, presumably, curse Israel. This messenger stood in front of the donkey such that the donkey kept changing course and getting beat by Balaam. Finally, the Lord opened the donkey's mouth to explain to Balaam what was happening. The Lord was protecting His inheritance.
The first time we see such a sword drawn messenger is at the east entrance of the garden of God, Eden. He is put there to protect the garden from any who would enter and eat from the tree of life. Adam and Eve had already eaten from the tree they were forbidden to eat, so a sword drawn messenger protects God's interests in that garden.
In Joshua 5, Israel has just entered the east entrance of the promise land, the garden of God, the land of milk and honey, and, lo and behold, our sword drawn messenger is there again, protecting the interest of God. It seems that it is this messenger in 6:2ff that gives instructions to Joshua regarding how to take the city of Jericho. And, we are led to believe this messenger is the one who told Joshua that everything in the city was to be devoted to the Lord (6:17), which means they could not partake of the spoils. It belonged to God. The idea was the same as that applied to the firstfruits. It was holy and therefore wholly devoted to the Lord.
But the Israelites acted unfaithfully in regard to the devoted things; Achan son of Carmi...took some of them. So the LORD's anger burned against Israel. (Joshua 7:1)
In Joshua 7 we find how Achan's sin effected the whole community (an interesting lesson in itself in our self-oriented culture), and how Achan was discovered. But it is Achan's confession we find a description of his sin, and a description of sin we often find in ourselves.
20 Achan replied, "It is true! I have sinned against the LORD, the God of Israel. This is what I have done: 21 When I saw in the plunder a beautiful robe from Babylonia, two hundred shekels of silver and a wedge of gold weighing fifty shekels, I coveted them and took them. They are hidden in the ground inside my tent, with the silver underneath."
We are also prone to taking what belongs to the Lord and using it for our own pleasures and purposes. How does it start? I suggest much the same as with Achan. We see something just like his “beautiful robe from Babylonia, two hundred shekels of silver and a wedge of gold weighing fifty shekels,” and we covet it. We want it more than we want to glorify God with what belongs to Him. Then, we bury it in the ground, the earth, by laying up our treasure in the earth rather than storing up treasure in heaven (see Matthew 6:19-21). And just like Achan, it brings trouble on the whole community.
By God's grace, unlike Achan, we aren't stoned to death, for Christ has already born our punishment. But that truth of the love of Christ, should all the more compel the Christian to “no longer live for themselves but for him who died for them and was raised again.”