Russian President Vladimir Putin on Wednesday threatened the West with "reciprocal measures" after several ships from its so-called shadow fleet were detained.

He said this was not limited to waterways in which Russian ships are seized "but wherever we deem it necessary and targeted." Putin appeared in uniform on a warship during a Pacific Fleet exercise off the island of Sakhalin.

Moscow is reacting to the European Union's actions, he said.

The detention of its ships has long angered Russia. Moscow describes it as piracy and has repeatedly threatened to deploy warships to protect its merchant vessels.

Former Russian president and current deputy head of the National Security Council Dmitry Medvedev was more specific.

"Russia has the right to attack any merchant ship of hostile states that is located both in our waters and in neutral waters if there is sufficient suspicion that it is transporting cargo in the interests of the enemy," Medvedev wrote on his Telegram channel.

By "enemy" he is likely referring to Ukraine. This would apply to any cargo and any ship, including outside the Black Sea, reports said.

Russia has been waging war against neighbouring Ukraine for almost four and a half years and has been hit with sanctions by the EU and other states as a result.

Several Western countries, including the United Kingdom, France and Sweden, have already briefly detained oil tankers sailing for Russia on suspicion of circumventing sanctions.

The aim is to stop Russia's oil sales, which are important for financing its war against Ukraine. Sanctions also apply to other areas of Russian shipping.