"At that time Joshua pronounced this solemn oath: 'Cursed before the Lord is the one who undertakes to rebuild this city, Jericho: "At the cost of his firstborn son he will lay its foundations; at the cost of his youngest he will set up its gates."'" NIV translation
Why would God have Joshua pronounce this curse? We must remember that Jericho was a symbol of man's works and its defeat was a work of God. Anyone who tries to undo the work of God (trust in man's works) will be cursed. This curse was fulfilled in the days of the wicked King Ahab. This was also the struggle of the early church as judaizers kept trying to bring the law back into the church and it continues to this day.
"So the Lord was with Joshua, and his fame spread throughout the land." NIV translation
Imagine what the rest of Canaan thought when they heard about how Jericho was defeated. The faith that was demonstrated by Joshua glorified God and people knew that God was with him. We each should ask ourselves if the same is true of us. We have God living in us through the Holy Spirit but can people tell?