It's a common retort used whenever Israel comes in for criticism. Israel is the only democracy in the Middle East. That, somehow, seems to entitle the Israeli government to a more lenient or favourable perspective on its actions than would be afforded other, as in Arab, countries in the region.
Are we to judge countries by their actions or by the mechanisms by which their leaders come to power?
By all accounts, Adolf Hitler was overwhelmingly popular with the German people. There seems little doubt that, had he stood for election in, say, 1941 or even 1944, he would have been popularly, democratically elected. Would that somehow have ameliorated his monstrous atrocities? Would they be a bit less egregious by virtue of the mechanism by which he came to power? Would it have made his massacre of so many millions of Russians less outrageous because he represented a democracy and they lived under totalitarian Stalin? Of course not.
In an era when democracy is revealing its frailties and foibles the very institution is falling into disrepute. In the self-proclaimed "greatest democracy on earth," the United States the government now comprises a politicized court of dubious legitimacy; a thoroughly bought and paid for Congress that does the bidding of affluent special interests instead of the voting public; and an executive that, by turns, shows itself to be indifferent to democracy or too feckless to defend it. Is that a democracy?
Can a nation be a democracy domestically but an outlaw state internationally? Of course it can. That's why we ought not to read very much into proclamations of democracy for any country and, instead, take that nation's actions as the full measure of its legitimacy.