Turkey has finally released American pastor Andrew Brunson who has been in detention on terrorism charges since 2016. That is a victory for the Trump administration and should help smooth over relationships with Turkey. But the U.S. must remain wary of Turkey and President Recep Tayyip Erdogan.

On Friday, after two years in detention drawing criticism and sanctions from the U.S., a Turkish court freed Brunson, sentencing him to time served.

For the Trump administration, the case had been a central hang up on improved relations with Ankara and became a rallying cry for religious freedom. Shortly after the verdict, Trump tweeted:

But Brunson’s release must not gloss over other issues in the U.S. relationship with Turkey.

The circumstances of the pastors arrest in the aftermath of a failed coup should be a stark reminder of Erdogan’s efforts to secure power and establish an increasingly authoritarian regime. In 2016, a faction within the Turkish Armed Forces attempted to seize several key locations in major cities including Ankara and Istanbul.

In the aftermath, Erdogan seized the opportunity and carried out mass arrests and purged the government of opposition. In the end, more than 77,000 people were arrested and more than 160,000 removed from their jobs, including thousands of teachers.

Many observers have pointed to these actions as well as seemingly unfounded accusations against the alleged mastermind of the coup as evidence that it was a stunt pulled off by Erdogan to grant himself more power.

[Related: Why Turkey released pastor Andrew Brunson]

In addition to this undemocratic and authoritarian bend, the U.S. has plenty of other disagreements with Turkey, including differing approaches to how to restore peace in Syria. That problem is exacerbated by U.S. alliance and support for Kurdish forces who have been a cornerstone of the fight against the Islamic State but who have been violently targeted by Turkey.

Additionally, Turkey has rightly drawn criticism from the U.S. over its plans to go through with a purchase of Russian advanced missile systems. That raises red flags for the U.S. and NATO because of security concerns regarding military technology already shared with Turkey that is not interoperable with existing NATO systems.

Despite these worries, Turkey does appear to be working to improve relations with the U.S. with an eye towards acquiring F-35 fighter jets and bolstering support as Turkish officials confront Saudi Arabia over the disappearance of journalist Jamal Khashoggi.

Trump would do well to take this opportunity to pursue a better relationship with Ankara, but must continue to push Turkey on its actions in Syria and pursuit of Russian missiles, as well as domestic power grabs.