The Holy verse says:
"We will cast terror into the hearts of those who disbelieve for what they have associated with Allah of which He had not sent down [any] authority. And their refuge will be the Fire, and wretched is the residence of the wrongdoers." (3:151)
The occasion of verse
The occasion of verse is during the battle of Uhud. In this battle, the Prophet appointed Abdullah Ibn Jubair as the commander of the infantry men (archers) who were fifty on the day (of the battle) of Uhud. He instructed them: 'Stick to your place, and don't leave it even if you see birds snatching us, till I send for you; and if you see that we have defeated the infidels and made them flee, even then you should not leave your place till I send for you.'
At first, the Muslims were winning. They entered the pagan camps and went on collecting what they found of equipment and material without meeting any resistance from the pagans. This scene watered the mouths of the fifty marksmen whom the Prophet placed at the slope of the Mount of Uhud to protect the back of the Muslims against the pagan cavalry.
The majority of these marksmen left their place and joined the collectors of the spoils. They did not heed the word of their leader Abdullah Ibn Jubeir, who reminded them of the instructions of the Messenger which made it mandatory for them not to leave their place. Noticing the small number of the marksmen, Khalid Ibn Al-Waleed, the leader of the pagan's army and his horsemen killed them then started a general offensive.
The fleeing pagans beheld their horsemen fighting and attacking. They came back to the battle while the Muslims were preoccupied collecting the spoils. The Muslims were astonished and confused. They were in total chaos and consequently lost the battle.
After the pagan won they returned to Mecca. On their way back they reconsidered returning back to kill the rest of the Muslims remaining in the battle field, but then, they decided not to because they were afraid that prophet Muhammad, peace and blessings be upon him, might have prepared extra troops to fight them so they retreated to Mecca. That is the situation the verse is explaining and that is the terror that was casted in the hearts of the disbelievers.
So casting terror in the hearts of the disbelievers at that occasion was to save the Muslims who were defeated and in a chaotic state.
From who's perspective is the verse violent?
Let's answer that simple question. Who is casting the terror in the hearts of the disbelievers? God. So the verse does not order Muslims to terrorize innocent disbelievers. In the verse God is encouraging the Muslims by telling them that He will help them by casting terror in the hearts of the disbelievers.
Let's look at the verse from different perspectives
1- The Muslims perspective
The verse represents a word of encouragement to the Muslims who were just defeated that they should not worry and that God will help them by casting terror in the hearts of the disbelievers.
2- The disbelievers perspective
For the disbelievers, this verse represents a threat that God will help the Muslims by HIM casting terror in the hearts of the disbelievers.
If the disbeliever is REALLY convinced that he is in the right side and that the Muslims are wrong and that the idols that he worships are the real Gods and they will defend him against the Muslims, then why will he be offended by the verse. He will not believe that the verse is revealed by God, so it will not cause any threat to him.
If the disbeliever knows that he is wrong and that he is in the wrong side just because of his stubbornness or his fear of his tribe or his partiality to his tribe even though he knows that they are wrong then this verse is like a bell ringing to him, a warning to reconsider where he is standing. He must review his attitude and do what his conscience dictates or else face the consequences. So the verse is actually a warning from a merciful God to this category of people, may they will wake up and do what they believe is right not what their tribe is dictating them.
So from the perspective of both sides the verse is NOT violent since the act of casting terror is not left for the Muslims to do, so there is no declaration of war or a pending massacre just a promise from God that he will cast terror in the hearts of the disbelievers because they denied that there is ONLY one God and associated with him idols that they know very well can never do them any harm or any good either.
This unjust association is done for no reason but economic benefits and tribal positions . That is what they did by their own free will and that is why they deserved having their hearts insecure and unstable because they rejected the dictates of their conscience and followed the wrongful dictates of their tribal society.