The attack in the Caspian Sea was an unusually direct encounter between two countries that have been on opposite sides for years.