By Orhan Coskun and Humeyra Pamuk
ANKARA/WASHINGTON (Reuters) - Turkey's hopes of avoiding punishing U.S. sanctions over its purchase of a Russian air defense system appear increasingly pinned on intervention from Donald Trump, but the president has little leeway to counter Ankara's many critics in Washington.
The two NATO allies have argued for months over Turkey's order for the advanced S-400 missile defense batteries, which Washington says are incompatible with the Western alliance's defense network and would pose a threat to U.S. F-35 stealth fighter jets which Turkey also plans to buy.
U.S. Secretary of State Mike Pompeo and several prominent U.S. senators have warned Turkey it will face penalties for buying the S-400s under legislation which calls for sanctions against countries procuring military equipment from Russia. Turkey says as a NATO member it poses no threat to the United States and the sanctions should not apply.
Resolving the dispute could allow the two governments to turn the corner on years of tense relations. The stakes are higher for Turkey, which is mired in recession after a separate U.S. diplomatic dispute last year sparked a currency crisis that has echoed in recent weeks as ties have again frayed.
Two months before the first batch of S-400s could arrive in Turkey, a team of senior Turkish ministers visited Washington this week for talks aimed at easing the crisis, culminating in an unexpected Oval Office meeting with the president.
"We are getting signals that Trump pursues a more positive attitude than Congress," a senior Turkish official told Reuters. "There might certainly be some steps to be taken but the search for common ground will continue."
Acting U.S. Defense Secretary Patrick Shanahan told reporters on Thursday: "We're closer" to a final decision on the S-400s after a meeting with his Turkish counterpart. "It's like: 'OK, where are we stuck? How do we get unstuck?" he said of the talks, adding he was optimistic.
Few details of the White House meeting have emerged, but Turkish media quoted Finance Minister Berat Albayrak, son-in-law of President Tayyip Erdogan, as saying Trump had a "positive understanding ... regarding Turkey's needs for the S-400s."
Other ministers and officials on the trip, including Turkey's defense minister and Erdogan's spokesman and national security adviser, said the visit gave Washington the chance to get a better understanding of Ankara's point of view.
Turkey has proposed a joint working group which it believes could help convince the United States that the S-400s do not pose a direct threat to the U.S. military or its jets.
The deadline on a U.S. counter offer to sell Turkey a discounted Patriot missile defense system was extended earlier this year and remains open, according to Turkish and U.S. officials.
But neither side has given any ground publicly. Turkey reiterated the Russian purchase was a "done deal" and the U.S. administration stuck by its warning that S-400s and F-35s could not operate in the same space.
"The U.S. made clear to the Turkish side that the risk of sanctions is real if they take delivery of the S-400s," a U.S. official told Reuters.
Even minor U.S. sanctions could prompt another sharp sell-off in the Turkish lira that deepens the recession in the Middle East's largest economy. After shedding 30 percent of its value last year, the currency is down another 10 percent and markets remain on edge.
Buying military equipment from Russia leaves Turkey liable to U.S. retribution under a 2017 law known as the Countering America's Adversaries Through Sanctions Act, or CAATSA.
To waive any CAATSA sanctions imposed by Congress, Trump by law would have to show that the S-400 purchase was not a "significant transaction", and that it would not endanger the integrity of NATO or adversely affect U.S. military operations.
He would also need to show in a letter to congressional committees that the deal would not lead to a "significant negative impact" on U.S.-Turkish cooperation, and that Turkey is taking, or will take, steps over a specific period to reduce its Russian-made defense equipment and weapons.
Erdogan's spokesman Ibrahim Kalin said he had heard Trump pledge in a phone call with the Turkish president two months ago that he would work to find a resolution to the problem. Other officials have also portrayed the U.S. president as sympathetic.
The talks were "more positive than expected" and the Americans expressed "a softer tone" than they take in public, a second senior Turkish official told Reuters.
Trump has not weighed in on Turkey in recent weeks. Even if Turkey did have his support, however, that common ground may prove elusive.
Relations between the two countries have been strained over several disputes including military strategy in the Syrian conflict, Iran sanctions, and Turkey's requests for Washington to extradite a Muslim cleric Ankara blames for a failed 2016 military coup.
The United States has also been angered by the detention of U.S. citizens in Turkey and three locally employed U.S. consular staff, one of whom was released in January, as well as clashes between Erdogan's security officers and protesters during a visit to Washington two years ago.
Those disagreements have left Erdogan with very few supporters in Congress, which could respond to any White House waiver with separate sanctions legislation.
In February, a bipartisan group of U.S. senators introduced a bill for stiff new sanctions on Russia in an effort to corner Trump into a stronger approach over meddling in U.S. elections and aggression against Ukraine.
"I don't think it's impossible for Turkey to get a waiver," said Soner Cagaptay, director of the Turkish Program at The Washington Institute. "But Turkey has almost no cheerleaders in Washington and that's why it would be an uphill battle."
He added: "CATSAA is written with the idea that there should be almost no loopholes. So Trump has to find a really good one."
(Additional reporting by Phil Stewart in Washington; Writing by Dominic Evans; Editing by Jonathan Spicer and Mark Potter)