Joshua 6:26 And Joshua adjured them at that time, saying, Cursed be the man before the Lord, that riseth up and buildeth this city Jericho: he shall lay the foundation thereof in his firstborn, and in his youngest son shall he set up the gates of it.
Jericho was given over to idolatry, graven images of gold and silver were everywhere and the worship of false gods had taken deep root to the point where it was considered quite normal and acceptable in that society for the vile and the evil to be indulged freely, being supported and financed by the leaders. That’s how the city, and everything in it came to be accursed, because the proof is in the pudding, and the wages of sin is death.
In other words, through the continual indulgence in sin, with no repentance, the city became permanently and inseparably linked to sin, and that produces the accursed condition. However, just for the record, the same merciful God who bore long with pharaoh, and Nebuchadnezzar, also dealt mercifully with the Amorites, who lived in the land for four hundred years. Therefore, when it is declared by God that the city is accursed, we must understand the issue in the context of His mercies, and forbearance.
[Patriarchs & Prophets pp 424] Although the Amorites were idolaters, whose life was justly forfeited by their great wickedness, God spared them four hundred years to give them unmistakable evidence that He was the only true God, the Maker of heaven and earth. Sufficient evidence was given; they might have known the truth, had they been willing to turn from their idolatry and licentiousness. But they rejected the light and clung to their idols.
Joshua 7:1 But the children of Israel committed a trespass in the accursed thing: for Achan, the son of Carmi, the son of Zabdi, the son of Zerah, of the tribe of Judah, took of the accursed thing: and the anger of the Lord was kindled against the children of Israel.
May The Lord add His blessing to the study of His word. God bless!