Islamic State's brand of terrorism has recently shocked the world once again, with sickening videos showing the torture, drowning and shooting of prisoners, and an IS-inspired massacre of 38 holidaymakers in Tunisia for which the group proudly claimed responsibility.
No less horrendous is the IS strategy of purposefully blending its fighters within civilian populations, in Iraq and Syria, even using small children as human shields. It has been reported that in Raqqa, Syria, the group is encouraging all men to grow beards in order to make terrorists and civilians look the same.
These tactics create horrendous dilemmas for coalition forces, the UK among them, as they seek to target IS forces and jihadi leaders while trying to protect the lives of the civilians they are hiding behind. Having deliberately created these dilemmas IS has no compunction about accusing the coalition of waging war directly on the Iraqi people.
The allegations are of course ridiculous, but imagine for a moment that someone took them seriously. Imagine that IS hired lawyers to produce a report accusing the UK and the coalition of war crimes. Imagine that IS then presented such a report to the International Criminal Court (ICC), with encouragement from the UN.
This scenario would make a mockery of international institutions, turning them into weapons against democracies trying to defend themselves from terror. In an absurd pincer movement, a terrorist group could attack a state physically with bombs, while at the same time work to undermine its ability to defend itself by legal action in an international tribunal.
What seems like a ludicrous suggestion is actually happening with regard to Hamas and Israel.
Surreally, we see Hamas representatives actively participating in and supporting legal proceedings in The Hague, calling for the prosecution of Israel for war crimes.
In a statement published last week, Hamas was handing out marks to the UN Human Rights Council for its report on Gaza, pointing to its deficiencies and criticising what it deemed as "lack of sufficient warning" prior to Israel Defense Forces (IDF) strikes, as well as the targeting of schools and hospitals.
Hamas, it should be recalled, is recognised as a terror organisation by the European Union, the US and here in the UK, and like IS has a gruesome track record of murdering civilians and hiding among them.
It acts in contravention of every possible law of armed conflict, uses UN installations as arms depots, hospitals as sniper positions and schools as rocket launching sites, its HQ is even located in the basement of Gaza's main hospital.
Yet it would like to play in all fields, to have its cake and eat it too: It acts like a terror group in Gaza, murdering its opponents and amassing arms instead of building homes, yet goes to great pains (including a new English website and twitter feed) to present a respectable face abroad, as if it were an NGO concerned with human rights and a peaceful solution to Gaza's problems.
Make no mistake, Hamas' interest in using the international bodies concerned with human rights and international law should set alarm bells ringing. Its motive for seeking to target Israel in these fora is clear: to gain a tactical advantage on the battlefield during the next fight, while placing Israel's military and political leaders at the risk of legal action.
Last week the Human Rights Council in Geneva, a body with an alarming track record of discrimination against Israel (it has passed more resolutions condemning Israel than all other countries combined) passed a resolution designed to put wind in the sails of this initiative.
Though directed against Israel, any democracy confronting the threat of terrorism should be wary of this campaign. When the instruments of law and justice become weapons in the hands of terrorist groups, the security of the family of nations is at stake.
If Israel is not protected from lawfare, then Britain and other Western democracies will fall victim to it soon after.
The author is spokesman for the Israeli embassy in London.