before posting any verses from the Quran,one has to consider its cultural and historical background.
In those days the weak are being eliminated and the strong rule. Warriors are being venerated and treated as heroes for obvious reason. They have no police and no proper enforcer of any law in fact there was no other law but the law of tribalism,the stronger the tribe the more respect and fear it gets.
Women are not repsected,vices are everywhere,it was a barbaric world to live in at least in the arabian peninsula. The religion of the day is paganism,in fact it was a big business. Like drugs,if someone tries to destroy the business somebody gets killed.
Now Allah called Muhammad to be a prophet and with the message that he preached oppression and war was evident. They were oppressed and threaten to be eliminated from the face of the earth.
No other choice but to fight...and these fights escalated. Muhammad successfully built a nation for allah but a long with it Enemies were also created.
In those days you have to be so strong and strict para ma enforce ang mga laws because people are not used to follow laws.