By Tulay Karadeniz and Tom Perry
ANKARA/BEIRUT (Reuters) - Turkey fired into Kurdish-controlled Syria on Wednesday after saying one of its soldiers was killed by a sniper from across the border, risking deeper conflict with a Kurdish militia backed by the United States and building ties to Russia.
The Turkish military said the soldier was killed in the Turkish province of Hatay, across the border from Syria's Afrin, which is controlled by the Kurdish YPG militia. It said it returned fire in retaliation.
YPG spokesman Redur Xelil told Reuters that Russian forces which deployed to Afrin earlier this week had headed to the area shelled by Turkey. Russia's Defence Ministry was not available for immediate comment.
"We will certainly not stand with our hands tied in the face of any aggression and we will use the right to respond in the framework of legitimate self defense," Xelil told Reuters in a written message.
The incident highlights the volatile nature of one of the most complicated theaters in the multi-sided Syrian conflict, where the United States, Turkey, Russia, Iran and Arab states have all backed local forces.
The YPG is a military ally of the United States and is playing a major part in U.S.-backed operations against Islamic State in areas of Syria further to the east.
It has also built ties to Russia, and said this week that Moscow was setting up a military base in Afrin and would help train its fighters.
Turkey, which is a NATO member and part of the U.S.-led coalition against Islamic State, views the YPG as a terrorist organization, an arm of the Kurdistan Workers Party (PKK) militant group fighting an insurrection in Turkey.
Ankara has been incensed by U.S. support for the YPG and has warned it will not tolerate a "terror state" being established in northern Syria. It accuses the YPG of rights abuses and of trying to displace Syrian Arab and Turkmen civilians.
Xelil said the Turkish army was the aggressor in Wednesday's incident and that Turkish shelling of border villages around Afrin had wounded 10 civilians.
To Turkey's dismay, Syrian Kurds have managed to bring both Washington and Moscow onto their side after showing themselves as an organized force able to confront jihadist groups and take back territory from Islamic State.
The Russian defense ministry said on Monday it had no plans to open new military bases in Syria but that a branch of its "reconciliation center", which negotiates local truces in Syria, had been located in Aleppo province near Afrin.
(Reporting by Tulay Karadeniz and Tom Perry; Writing by Tuvan Gumrukcu; Editing by Nick Tattersall and Ken Ferris)