Istanbul (AFP) - From the 2003 US invasion of Iraq to Washington's latest decision to arm Kurdish groups in Syria, relations between Turkey and the US have been tested repeatedly.

The two NATO allies often have conflicting goals in the Middle East, and Ankara is now cultivating closer ties with Moscow and Tehran. These are the key sticking points.

- IS or Kurds? -

In September 2011, six months after peaceful protests against Syrian President Bashar al-Assad were harshly repressed, Ankara cut the Syrian regime loose and began to back selected opposition groups. In 2013, NATO deployed Patriot missile defence batteries in southern Turkey to protect it against possible Syrian attacks.

But Syria and Russia, a key ally, accused Turkey of allowing arms and oil trafficking to flourish with jihadist elements in Syria and Iraq, both of which share borders with Turkey.

In August 2015, Turkey joined a US-led coalition fighting the IS, after being hit by a deadly suicide attack near the border in July.

President Recep Tayyip Erdogan declared a "war on terrorism" aimed at the Kurdistan Workers Party (PKK) as much, if not more so, than the IS.

In August 2016, Turkey launched operation Euphrates Shield in northern Syria, targeting IS fighters but also Kurdish Peoples' Protection Units (YPG).

Ankara says the YPG is linked to PKK separatists inside Turkey, who have waged an insurgency since 1984 that has killed more than 40,000 people.

But Washington backs the Syrian Democratic Forces (SDF), of which the YPG makes up roughly half, and which has been effective in fighting the IS group.

In April 2017, Turkish warplanes struck a YPG headquarters in Syria and also a pro-Kurdish militia force in Iraq.

On May 9, Washington said it will authorise the arming of the YPG, a decision Turkey called "unacceptable".

- Gulen -

On the night of July 15-16, 2016, an attempted coup by members of the Turkish army, aimed at toppling Erdogan, left almost 250 people dead.

Erdogan blamed the coup on Muslim preacher Fethullah Gulen, who lives in the US state of Pennsylvania. The Turkish leader has pressed the US to extradite the cleric, to no avail.

Turkey has carried out widespread purges of the civil service to get rid of Gulen supporters.

- Armenia -

In April 2017, US President Donald Trump termed the massacre of Armenians in 1915 "one of the worst mass atrocities of the 20th century." He did not qualify it as genocide however, though that did not prevent Turkey from sharply criticising what it called "misinformation" and "false definitions."

Obama had said during his 2008 campaign that he would recognise the massacres as genocide, but he never used the term once he had won election.

- Human rights -

In April 2016, Obama criticised a "troubling" path that Erdogan might be putting Turkey on with respect to freedom of the press, a day after the two leaders met in Washington.

The Turkish authorities are accused of being authoritarian and of repressing the media and opposition members.

- Iraq -

In 2003, relations deteriorated between Turkey and the US when Ankara refused to allow its territory to be used during the US invasion of neighbouring Iraq.

Turkish officials did however allow US aircraft to fly over the country during the subsequent fighting, and helped with supply operations and US troop rotations.