The Israelites had broken the 2nd Commandment and had been worshiping false gods. The Lord had removed His favor from them and had made them susceptable to persecution by others.
Rather than recognizing their sin and repenting, they continued in their sin and blamed the Lord for their woes.
I am always amazed at all of the scriptures both from the OT and the NT where the Israelites, the apostles and others who have given their lives over to the Lord subsequently fall way from His precepts, from His law and even go as far as denying that they know Jesus (as in the case of Peter)! And then I reflect on my own life and my walk and I realize that I have done, or am doing the same things in my life!
Only through constant prayer, reading and studying His word am I able to stay focused. I am still a sinner, but I strive to grow closer to Him and to follow His way.