The fact that God gave us commandments imply that we can choose to follow them or not.
For example, "You shall not bear false witness against your neighbor."
There is no commandment like "You shall not err when calculating the square root of a number"
If a divine commandment presupposes choice, then sin (the violation of God's Law) presupposes intent.
That's the whole point of God knowing our hearts, a concept well embedded in the Bible.
Let's remember the case of Simon, the sorcerer. He had converted and baptized, but he still had this superstitious mindset. In his view, miracles were done if the proper words were uttered, or the proper rites were performed. Working miracles was a "technique" that could be taught and learned. So he offered the apostles money in exchange for teaching him how to lay hands and make people heal or speak in languages.
Peter reacts this way:
“May your money perish with you, because you thought you could purchase the gift of God with money! You have neither part nor share in this matter, for your heart is not right before God. Therefore repent of your wickedness, and ask God if perhaps the intention of your heart may be forgiven you.”
So, Peter recognizes that, although his first impression is that Simon has committed a big sin, God will consider the intention of his heart. Peter offers hope to Simon. Then Luke bothers to present Simon's frightful reply: “Pray to the Lord for me that nothing you have spoken may come upon me.” Simon reveals once more his magical way of thinking: God's wrath may be appeased if the right people (the apostles) intercede.
What do I experience when reading the case of Simon The Sorcerer? Compassion. If I, being so arrogant and stupid, feel compassion for that man, how much compassion could God, who knew his heart, offer?
There are other examples of the relevance of intent in the Bible. We can go through them perhaps at another thread if anyone is interested.