It's war (albeit undeclared), and the Iranian vessel was a warship in international waters, so a fair target. Same as when, during the undeclared Falklands War, the British submarine HMS Conqueror sank the Argentine cruiser ARA General Belgrano in international waters. The Iranian frigate
IRIS Dena was hardly
defenseless, being armed with anti-submarine torpedo launchers, hull-mounted sonar, and a Bell
ASW-helicopter. However the Iranian captain does not seem to have remembered that he was at war and seemingly had no ASW underway, and thus lost his ship.