There is an account in Luke 20:1-8 about a confrontation between the Sadducees and Jesus. They demanded to know by what authority he did the things he did. He answered them with a tough question. It was tough because the right answer was an answer they were unwilling to give. "And he answered and said unto them, I will also ask you one thing; and answer me: The baptism of John, was it from heaven, or of men?" They didn't want to give the right answer because they did not follow John. They wouldn't give the answer they wanted to give because it would have been unpopular with the people. Therefore they gave no answer, and Jesus did not answer their question.
I recently read an article about Jericho that brought up a similar "difficult" question. It is difficult because the answer some people want to give is clearly not the answer God gives. But if they answer correctly then one could ask, like Jesus would have answered the Sadducees, "Then why didn't you believe?" The question is this: when the walls of Jericho fell before the Israelites, whose doing was it, God's or the Israelites'?"
Some might answer that it was the doing of the Israelites. After all, they marched around the walls once a day for six days, then seven times on the seventh, then blew their shofars and shouted, and the walls fell down. But consider, if God didn't make the walls fall down might the Israelites not still be marching and blowing today, expecting the walls to crumble? "And the LORD said unto Joshua, See, I have given into thine hand Jericho." (Josh 6:2) Jericho was a free gift of God. It was God's grace that made the walls to fall down.
Based on that, many would then answer that it was God's doing that the walls fell down. And they would be right. But would the walls have fallen if the Israelites had not demonstrated their faith by their obedience? If they had said that God was giving them Jericho so that nothing they could do would result in the walls falling down or not falling down, might they not be sitting outside the intact walls of Jericho even today? God gave them the city, but expected them to march around the walls in order to receive the gift. Did they "earn" the victory by marching around the walls? In no way! The victory was assured. God had promised it to them, and all they did was accept the promise.
God has another gift for us. It is called salvation. Does it come from God or man? Certainly by the grace of God. Do we need to earn the gift? Certainly not! Then it would no longer be a gift. But have we nothing to do to receive that gift? Some would say so. Some say that obeying God's order to march around Jericho constituted working for the victory. In like manner they say that obeying God by the "works" of faith, repentance, confession, and baptism constitutes man's attempts at earning the grace of God. In both cases, Jericho and salvation, the gift of God was free for the taking. Nobody could earn either gift, because God has it all wrapped up and ready for us to open. Marching around Jericho was not earning the gift; it was opening the gift. Being baptized for the remission of sins (Acts 2:38) is not earning the gift; it is opening the wrapping.
Paul told the Corinthians (1 Cor 15:3-8) that the gospel was the death, burial, resurrection, and post-resurrection appearances of Jesus the Christ. He told the Romans (Rom 6:3-6) that baptism was a burial with Christ, necessary before a new life. It is, then, not earning salvation, but showing the world the gospel. Peter and Paul both said it was essential before receiving remission of sins. It is the marching around Jericho that brings down the walls of sin.