ISTANBUL — A Russian naval intelligence ship sank Thursday after colliding with a merchant freighter in the Black Sea near Istanbul, the Turkish coast guard said. All 78 crew members on the Russian vessel were rescued.

The crew of the freighter, a Togo-flagged ship traveling from Romania to Jordan and carrying 8,800 sheep, was unharmed and the ship suffered slight damage to its bow, according to local media reports.

In Moscow, Russia’s Defense Ministry issued a statement confirming that the vessel, the Liman, went down after the collision tore a hole in the hull below the waterline.

Russian officials did not immediately provide any information about the Liman’s mission. The Russian state-run Sputnik news agency reported in 2016 that the Liman had been deployed in the Black Sea to monitor the joint Sea Breeze naval exercises between Ukraine and several NATO countries, including the United States. Russian officials had complained that the joint exercises were provocative.

Turkey’s prime minister, Binali Yildirim, called Russian President Dmitry Medvedev to express “sadness,” Turkey’s semiofficial Anadolu news agency reported.

Russia and Turkey have developed increasingly warm ties over the last year, putting aside bitter differences over the war in Syria to cooperate on brokering a political solution to the conflict. The relationship reached a low point in 2015, when Turkey shot down a Russian warplane that Ankara said had strayed over the Syrian border.

The collision occurred about 20 miles northwest of the Bosporus Strait, one of the world’s busiest waterways connecting the Black Sea to the shipping lanes leading to the Mediterranean.

The Liman had also previously been deployed for three months to the coast of Syria in the Mediterranean Sea, where Russia is in the second year of an intervention to back President Bashar al-Assad against a wide array of rebel groups, including Islamist fighters and others with U.S. backing.

Ship spotters in the Bosporus photographed the ship traversing the strait near Istanbul under heavy snow in January.

It is not clear whether the ship was headed toward Syria on Thursday.

The Liman was built as a hydrographic survey vessel in the Gdansk shipyards in Poland in 1970 and later converted for military service in 1989, shortly before the fall of the Soviet Union. The ship is outfitted to capture signals intelligence, largely communications, using an array of Soviet and Russian-made sensors that have been retrofitted onto the ship.