Russian S-400 Triumph surface-to-air missile systems in the Victory Day parade in Moscow, May 9, 2016. REUTERS/Grigory Dukor

Turkey reached an agreement with Russia to purchase the latter's most sophisticated missile-defense system, the S-400, a senior Turkish military official told Bloomberg last week.

Under the $2.5 billion agreement Ankara would receive two batteries of the antiaircraft missile from Moscow within the coming year and then produce two more batteries in Turkey.

At the beginning of June, Russian President Vladimir Putin said Moscow was ready to deliver the missile system, and a Russian military-industry official said an agreement on technical details had been reached in mid-June.

Turkey stepped up efforts to acquire its own missile-defense system after the US, Germany, and the Netherlands — all NATO members — decided at the end of 2015 not to renew their Patriot-missile deployments in southern Turkey. Spanish and Italian missile batteries remain in the country, but those systems are linked to the NATO air-defense system.

The deal has not been finalized and could still fall through, as has happened before — under pressure from the US, Turkey scrapped plans to buy missiles from a Chinese state-run company that had been sanctioned for allegedly selling missiles to Iran. (Ankara has also sought out alternative missile systems from the US and France.)

But the agreement has deepened concern that Turkey is drifting away from its longstanding alliance in NATO, which it joined during the security bloc's first enlargement in 1952.

Turkey has been on high alert since 2015 after a series of attacks blamed on Kurdish militants and ISIS jihadists. AFP

The S-400 deal "is a clear sign that Turkey is disappointed in the US and Europe," Konstantin Makienko, an analyst at Moscow-based think tank the Center for Analysis of Strategies and Technologies, told Bloomberg. "But until the advance is paid and the assembly begins, we can’t be sure of anything."

"The problem is, how do you interoperate in the NATO system with Russians? They'll never interoperate," US Defense Secretary James Mattis told reporters on Friday. "We'll have to see — does it go through? Do they actually employ it? Do they employ it only in one area? All that kind of stuff. But you know, we'll have to take a look at it."

The S-400 system can detect and target manned and unmanned aircraft and missiles and hit targets up to 250 miles away. But it is not compatible with NATO systems, nor would it be subject to the same NATO limits on deployment, meaning that Ankara could set it up in places like the Armenian border or Aegean coast.

Russian President Vladimir Putin and Turkish President Recep Erdogan at a news conference in Sochi, Russia, May 3, 2017. Thomson Reuters

A Turkish official also told Bloomberg that the S-400s delivered to the country would not have friend-or-foe identification systems, making them deployable against any target.

While Russia is unlikely to supply Turkey with its most up-to-date missile system, the deal would give Ankara a leg up on its goal to build defense-industry capacity — which may stem in part from Western reticence to exchange advanced technology with Turkey.

The licensing agreement allowing Turkey to produce S-400 batteries domestically would save it some of the billions needed to create a new industry, Makienko told Bloomberg.

"Either way, this is in line with Turkey's massive weapons modernization drive that saw the emergence of new land, air and sea-based systems for domestic use and export," Center for Naval Analyses researcher Sam Bendett told The National Interest.

Turkey has also discussed a missile-system purchase with a Italian-French joint venture, and agreements with Russia may be a means to gain leverage in those negotiations.

The deal may also serve political purposes.

Turkey's relationship with other NATO members has been strained, in part because of the ongoing war in neighboring Syria — sentiment that appears to have intensified after the attempted coup against Turkish President Recep Tayyip Erdogan in July 2016.

Policemen stand on military armored vehicles after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, July 16, 2016. Murad Sezer/Reuters

Turkish officials were reportedly disappointed in NATO countries' response to the coup, and Erdogan's crackdown in the months since has been criticized by members of the security bloc. Ties with Germany are especially strained, and Berlin is currently redeploying its troops and equipment from a base in southern Turkey to positions elsewhere.

It may also be Turkey's way of spurning the EU, the political and economic bloc that has in the past recognized Ankara as a candidate for membership. Foundering accession talks were scrapped by the EU in late 2016, amid Erdogan's post-coup-attempt crackdown.

On Sunday, Erdogan accused the EU of "messing us about," citing the bloc's broken promises over issues like visa deals and Syrian migrants. "We will sort things out for ourselves," he said. "There's no other option."

Turkish officials have said more than once that dealings with Russia shouldn't be seen as a search for an alternative to either the EU or NATO. But observers in Russia described it as a significant development

The S-400 system would "close Turkish skies," to Western aircraft in particular, Makienko, the Moscow-based analyst, told Russian news site Vzglyad, according to Russian state-owned outlet Sputnik. "If the Turks really purchase Russia's missile defense systems, it will be a tectonic shift, a game-changer in the arms market," he said.