Deep issues are involved here. Briefly my own approach is to suggest that governments are not moral agents but the individual members of governments are and that (here comes to controversial point) I do not believe that the same moral rules apply to individuals acting in their political, governmental capacities as apply to individual citizens.
What this doesn't mean - 1
I don't intend to suggest that an individual's moral convictions should be set totally aside when they enter government, a wholly unacceptable idea. I oppose capital punishment. I oppose racial discrimination. I oppose child molestation. These are among my moral beliefs and I would and should stick by them even if (as is unlikely) I held political office.
What it does mean
Here's the tricky part which will very likely provoke disagreement. I believe that because of the hugely consequential responsibility that politicians bear and their accountability on occasion for the very survival of their communities, political morality is not to be confined within the bounds of private morality. Where it would be wrong for me as an individual, for instance, to tell a lie, it can be and often is permissible for a politician to lie to another country to prevent, say, a war.
Again, it can be on occasion morally right to withhold information from the public in the interests of preventing a mass panic which would make an emergency even more difficult to deal with.
What it doesn't mean - 2
There are, however, limits to the extent of freedom for politicians, members of governments, to override the restrictions of private morality. Lying to prevent a war is one thing; carrying out a policy of ethnic cleansing is quite another. There is (a) private morality; there is (b) political morality which can at times and rightly deviate from private morality; and there is (c) political immorality which is excusable on no grounds whatever. In this category are war crimes and crimes against humanity which are morally completely out of bounds and not covered by the moral 'flexibility' of (b).
Hampshire, S.N., ed., Public and Private Morality, ISBN 10: 052122084X / ISBN 13: 9780521220842
Published by Cambridge University Press, 1978
Myers, Robert J., International Ethics in the Nuclear Age (Ethics and Foreign Policy Series), ISBN 10: 0819166928 / ISBN 13: 9780819166920
Published by Univ Press of America, 1988.