Kamma works outside the guidelines of a government's laws. Take a look at this excellent post by Ven. Gavesako:
gavesako wrote:I listened to a talk between Ajahn Chah and a group of visitors headed by Sanya Dharmasakti (Chief Privy Councillor). Ajahn Chah was talking about the principle of kamma. Then one of the visitors, a military officer, asked about "doing one's duty" which might mean using violence sometimes. Ajahn Chah's reply was very direct: no matter if you call it "your duty" or not, if you use violence to kill living beings, it is definitely bad kamma. He emphasised that Dhamma and worldly laws are quite separate, that the law of kamma operates outside of the conventions of society. He kind of paused a little, because his visitors were high ranking Bangkok civil servants and officers, but then stressed again: you can't say that you haven't committed bad kamma by calling it "your duty". It may be necessary in order to keep law and order in society to use some harsh methods, but it is nevertheless within the sphere of kamma. He didn't make any flattering comments to them because of their social rank, he just gave them straight Dhamma using some down-to-earth similies.
I'll repeat this part again, because I think it so appropriate:"worldly laws are quite separate, that the law of kamma operates outside of the conventions of society"
Governments quite regularly have unjust laws and the fact that something is legal or not does not make it "right."