WASHINGTON (Reuters) - For some U.S. officials, the Trump administration’s failure to persuade Turkey not to buy a Russian air defense system may have its roots in a coup attempt against President Tayyip Erdogan three years ago this week.

FILE PHOTO: People walk past Russian S-400 missile air defence systems before the military parade to commemorate the 75th anniversary of the battle of Stalingrad in World War Two, in the city of Volgograd, Russia February 2, 2018. REUTERS/Tatyana Maleyeva/File Photo

While they recognize that worsening U.S. relations with Turkey in recent years and Russia’s growing clout with Ankara may also have helped sway Turkey toward buying the S-400 system, three U.S. officials and a defense source told Reuters of another working theory that has gained ground within the Trump administration.

One reason Erdogan may have chosen to buy from Russia rather than from a fellow NATO member is that he might be wary of his own air force, which played a major role in the coup attempt on July 15, 2016, these officials say.

S-400 missiles, which Turkey began taking delivery of last Friday, would be better at fending off any attack on the Turkish government from its own jets than a U.S.-supplied Patriot system would, experts say.

Raytheon Co’s’s Patriot missiles, which have been on offer to Turkey, would have safeguards to help avoid “friendly fire” against other NATO warplanes, such as Turkish air force jets.

“You have to ask yourself: Why would Erdogan really want a Russian system?” one of the U.S. officials asked. “He doesn’t trust his air force.”

Two other U.S. officials and a defense source familiar with NATO discussions about Turkey, all of whom spoke on condition of anonymity, put forward the same theory about the long-time Turkish leader’s possible motivation.

“There’s some talk that he wants the (Russian) system just to protect himself. He doesn’t want a NATO-integrated system,” one of the officials said.

A senior Turkish official denied that concern about the military was a motivating factor in the decision and said Turkey has been purging supporters of the coup attempt, including from the armed forces.

“Turkey is not worried about another coup attempt and it trusts its own army and pilots,” he said, when asked about the U.S. speculation.

Another Turkish official, with knowledge of the S-400 deal, said Ankara had always wanted to buy Patriots but was forced to turn to Russia.

“There was no uncertainty about this (wanting Patriots),” he said. “However, the U.S.A. had a delaying attitude during Obama’s term of office.”

Erdogan himself has said Turkey bought the S-400s because Russia made him a better deal, and Turkish officials sought tough terms from the United States on Patriot pricing, joint production and technology transfer.

President Donald Trump has publicly defended Erdogan, saying Ankara only chose the Russian system because Trump’s predecessor, Barack Obama, failed to offer him a viable U.S. alternative until it was too late.

But the Turkish purchase has upset Washington and could drive a wedge into the heart of NATO.

The Pentagon, which sees the S-400 as a threat to the most modern stealth fighter jet in its arsenal, the F-35, announced on Wednesday that the United States would drop plans to sell the jet to Turkey.

JETS IN THE COUP

Turkish air force pilots played a major role in the abortive putsch, commandeering jets and helicopters that bombed the parliament building and threatened a government plane that Erdogan was flying in. The coup attempt collapsed within hours but 251 people died and more than 1,500 were wounded.

In June, a former head of the Turkish air force, Akin Ozturk, was sentenced to life in prison for his involvement in the coup. Just this month, Turkish prosecutors ordered the arrest of 176 more military personnel over their links to the alleged coup-plotting network.

Another of the U.S. officials described a 2018 meeting with American officials in which Turkish officials, when talking about buying a new air defense system, described their own air force as one of the top security threats facing the country.

“A Turkish bureaucrat said the primary threat to the government remained from Turkey’s own air force, which operated NATO aircraft and had attacked government installations and attempted to assassinate President Erdogan during the July 2016 coup attempt,” said the official, who had detailed knowledge of the meeting but did not attend it.

“And the S-400 system was designed to counter NATO aircraft,” the official said.

To be sure, even proponents of the theory that Erdogan’s worries about his own military fueled the S-400 purchase acknowledge there were almost certainly other factors behind it.

Those include Russia’s growing power in the Middle East, splits between Ankara and Washington over the war in Syria, and even Erdogan’s own sense of pride in the face of U.S. pressure to back out of his deal with Russia.

Erdogan has also been angered by Washington’s refusal to extradite Fethullah Gulen, a Pennsylvania-based Muslim cleric who Turkey says engineered the coup. Gulen denies involvement.

Some U.S. officials long held out hope that they could eventually sway Erdogan into forgoing the S-400 in favor of Patriot missiles, only to see their offers frequently rebuffed.

Soner Cagaptay, a Turkey expert at the Washington Institute for Near East Policy think tank, acknowledged the view inWashington that Erdogan was buying the S-400 for his own protection.

But he also pointed to Russian President Vladimir Putin and the possibility that Moscow can work with Ankara to thwart YPG Kurdish guerrillas in Syria. Turkey views the YPG as terrorists.

“I think, though, the bigger driver...(is that) Erdogan has realized that the U.S. will not help him in Syria against the YPG, and Putin will,” Cagaptay said. “In return, Putin has lured Turkey into lucrative deals and bargains, many of which undermine Turkey’s pro-Western orientation, the S-400 purchase being a case in point.”