ANKARA (Reuters) - Turkey will resist U.S. efforts to impose sanctions on Ankara over the trial of a Christian pastor who has been detained for two years, President Tayyip Erdogan said on Monday, accusing the preacher of having “dark links with terror”.

FILE PHOTO: Turkish President Tayyip Erdogan with his wife Emine are seen in a car as they arrive in Berlin, Germany, September 27, 2018. REUTERS/Hannibal Hanschke/File Photo

The case of evangelical pastor Andrew Brunson, whose next court hearing is on Oct. 12, has plunged ties between Ankara and Washington into crisis, leading to U.S. sanctions and tariffs which helped push Turkey’s lira to record lows in August.

Brunson is charged with links to Kurdish militants and supporters of Fethullah Gulen, the cleric blamed by Turkey for a failed coup attempt in 2016. He has denied the charges and Washington has demanded his immediate release.

Relations between the two NATO allies were already strained by disputes over U.S. support for Kurdish fighters in northern Syria, Turkey’s plans to buy a Russian missile defense system, and the jailing of a Turkish bank executive for violating U.S. sanctions on Iran.

“We are deeply saddened by the current U.S. government, a strategic partner, targeting our country without any logical, political and strategic consistency,” Erdogan said in a speech to a new session of parliament.

Erdogan said Turkey was determined to fight, within legal and diplomatic frameworks, “this crooked understanding, which imposes sanctions using the excuse of a pastor who is tried due to his dark links with terror organizations.”

Brunson’s case has become the most divisive issue between the two countries. U.S. President Donald Trump believed he and Erdogan had agreed a deal to release him in July, but Ankara has denied agreeing to free the pastor as part of a wider agreement.

Brunson, who has been jailed or held under house arrest since October 2016, faces up to 35 years in jail if convicted. Last month the main prosecutor in his trial was replaced, a move which his lawyer cautiously welcomed, saying it might be a sign of changing political will.

In his speech to the first session of parliament since its summer recess, Erdogan held out the possibility of better relations, while adding that there was still much work to do.

“We can say that we started to make progress towards reaching a common understanding (with the United States), although it is not at the desired level,” he said.

He also repeated Turkey’s accusation that Washington is protecting Gulen, who has been based in the United States for two decades, and said the conviction in a New York court of an executive of state-owned Halkbank for violating U.S. sanctions on Iran was “an example of unique unlawfulness”.

Tensions with Washington contributed to a meltdown in the Turkish lira in August, when the currency hit a record low of 7.20 to the dollar. It had already weakened over concerns at the extent of Erdogan’s control of the economy and opposition to raising interest rates to combat double-digit inflation.

Erdogan said Turkey’s economy was overcoming what he described as “midnight operations” designed to break it.

“Our economy started rebalancing with measures we have taken, meetings we have realized and programs we have developed,” he told parliament.

The lira TRYTOM=D3 firmed more than 2 percent on Monday, reaching its strongest level in more than six weeks, on growing optimism that Brunson might be released and following a hike in interest rates and the govenrment's new economic program.

Turkey’s exports also rose sharply in September, the trade ministry said, but Turkish manufacturing activity slid to its lowest level in nine years, a business survey showed.