(Bloomberg) -- Turkey-U.S. ties show signs of improvement after some troubled years, boosting optimism among investors in the nation’s assets that better days may lie ahead. Their positive sentiment is critical to Turkey -- a country that relies on money from abroad to finance its foreign imbalances and credit-driven growth.

Here’s a look at how the two NATO allies are trying to fix a relationship fraught with a myriad problems that range from disagreements over Syria to Washington’s response to the failed coup attempt against President Recep Tayyip Erdogan in 2016.

1. What’s sparked all the hope?

A slew of events, triggered by the release of pastor Andrew Brunson, held in Turkey for about two years on allegations of espionage that the U.S. said were drummed-up for political reasons. In response to his freedom, Washington removed sanctions on two members of the Turkish government and gave an exemption to the nation’s largest oil refinery from Iranian sanctions renewed this week.

Discussions about Turkiye Halk Bankasi AS, a state lender whose investors are bracing for a fine from the U.S. Treasury, are on a “positive path,” Erdogan said this week. That was just before the U.S. took the symbolic step of authorizing rewards for any tip-offs that could help capture the leaders of Kurdish separatists PKK, a group labeled as terrorists by Turkey, the U.S. and the European Union.

2. Why were relations so strained in the first place?

The countries’ friendship has been battered by an array of security and economic flashpoints in recent years, though the refusal by a Turkish court earlier this year to free Brunson marked a definite low point. U.S. sanctions on members of the Turkish cabinet followed that ruling, along with the risk of further punitive action. As the lira slumped in the weeks that followed, Turkish politicians complained of a coordinated attack on the nation’s economy.

The Ankara-Washington alliance has been fraught for a while, though. Erdogan was deeply angered when the U.S. reacted slowly to condemn the 2016 bid to topple him. The erosion in mutual confidence worsened as the U.S. armed and equipped Syrian Kurdish groups that Turkey argues are an extension of the PKK separatists.

3. Any other problems that could ruin the bonhomie?

Plenty. Turkey’s plan to buy Russia’s S-400 missile defense system is among the trickiest. Erdogan hasn’t stepped back from his pledge to install the Russian gear, which is incompatible with NATO requirements.

Also, Turkey is holding at least three other controversial detainees who have drawn attention in Washington, including NASA scientist Serkan Golge and three local employees of the U.S. diplomatic mission. For its part, Turkey has pressed the U.S. to extradite Fethullah Gulen, an exiled cleric Erdogan blames for the attempted 2016 putsch.

Then there’s Syria, an issue that has strained ties because of U.S. support for Kurdish fighters in the region. Turkey has recently shelled U.S.-backed Kurdish fighters in an area of northern Syria where American forces are embedded, prompting expressions of “great concern” from the U.S.

Lastly, despite Erdogan’s upbeat comments on the subject, there is still the prickly question of Halkbank, whose deputy chief executive officer was convicted in a New York court earlier this year of participating in a scheme to evade U.S. sanctions on Iran.

4. What do investors expect to happen next?

Turkey is a key component of a solution in Syria and the U.S. seems to have started to acknowledge that Turkey is extremely important to its Middle Eastern strategy, according to Anastasia Levashova, a fund manager at Blackfriars Asset Management in London. “So I expect the ‘carrot and stick’ policy of the U.S. toward Turkey to continue, with a period of ‘strong stick’ in 2017-2018 and a bit more ‘carrot’ in 2019,” she said.

For Nigel Rendell, a London-based senior analyst at Medley Global Advisors, the U.S. and Turkey may have different views, but need a policy of getting along -- even if they agree to disagree. “The alternative is a destabilizing diplomatic relationship that creates uncertainty and instability both in Turkey and in neighboring countries,” he said.

To contact the reporter on this story: Tugce Ozsoy in Istanbul at tozsoy1@bloomberg.net

To contact the editors responsible for this story: Blaise Robinson at brobinson58@bloomberg.net, John Viljoen, Jon Menon

©2018 Bloomberg L.P.