WASHINGTON (AP) — President Donald Trump welcomed American pastor Andrew Brunson to the Oval Office on Saturday, celebrating his release from nearly two years of confinement in Turkey that had sparked a diplomatic row with a key ally and outcry from U.S. evangelical groups.

Brunson, who returned to the United States aboard a military jet shortly before their meeting, appeared to be in good health and good spirits. He thanked Trump for working to secure his freedom and then lead his family in prayer for the president. “You really fought for us,” he told Trump.

ASSOCIATED PRESS President Donald Trump prays with American pastor Andrew Brunson in the Oval Office of the White House.

“From a Turkish prison to the White House in 24 hours, that’s not bad,” Trump said.

Administration officials cast Brunson’s release as vindication of Trump’s hard-nosed negotiating stance, saying Turkey tried to set terms for Brunson’s release, but Trump was insistent on Brunson’s release without conditions. Trump maintained there was no deal for Brunson’s freedom, but the president dangled the prospect of better relations between the U.S. and its NATO ally.

“We do not pay ransom in this country,” Trump said.

Where previous administrations kept negotiations over U.S. prisoners held abroad close to the vest, Trump has elevated them to causes célèbres, striking a tough line with allies and foes alike.

Trump thanked Turkey’s president, Recep Tayyip Erdogan, who had resisted the demands of Trump and other high-level U.S. officials for Brunson’s release. Erdogan had insisted that his country’s courts are independent, though he previously had suggested a possible swap for Brunson.

The U.S. had repeatedly called for Brunson’s release and, this year, sanctioned two Turkish officials and doubled tariffs on steel and aluminum imports citing in part Brunson’s plight.

Trump said the U.S. greatly appreciated Brunson’s release and said the move “will lead to good, perhaps great, relations” between the U.S. and fellow NATO ally Turkey, and said the White House would “take a look” at the sanctions.

Brunson’s homecoming amounts to a diplomatic high note for Trump, who is counting on the support of evangelical Christians for Republican candidates in the Nov. 6 election. Thousands of Trump’s supporters cheered Friday night at a rally in Ohio when Trump informed them that Brunson was once again a free man.

Trump asked Brunson and his family which candidate they voted for in 2016, saying he was confident they had gone for him. “I would like to say I sent in an absentee ballot from prison,” Brunson quipped, before praying that God grant Trump “supernatural wisdom.”

Evangelical voters overwhelmingly voted for the president despite discomfort with his personal shortcomings, in large part because he pledged to champion their causes, from to defending persecuted Christians overseas to appointing conservative justices to the Supreme Court. In the space of seven days, less than a month from the midterm elections, Trump delivered on both fronts.

Brunson’s case has been championed by prominent evangelical leaders such as Tony Perkins, as well as Vice President Mike Pence.

First word of Brunson’s arrival back on American soil Saturday came from Perkins, president of the Family Research Council. Perkins tweeted just after noon that he had landed at a military base outside Washington with Brunson and his wife, Norine.

Erdogan said on he hoped the two countries will continue to cooperate “as it befits two allies.” Erdogan also called for joint efforts against terrorism, and he listed the Islamic State group, Kurdish militants and the network of a U.S.-based Muslim cleric whom Turkey blames for a failed coup in 2016.

Relations between the countries have become severely strained over Brunson’s detention and a host of other issues.

A Turkish court on Friday convicted Brunson of having links to terrorism and sentenced him to just over three years in prison, but released the 50-year-old evangelical pastor because he had already spent nearly two years in detention. An earlier charge of espionage was dropped.

Hours later, Brunson was flown out of Turkey, his home for more than two decades. He was taken to a U.S. military hospital in Landstuhl, Germany, for a medical checkup.

“I love Jesus. I love Turkey,” an emotional Brunson, who had maintained his innocence, told the court at Friday’s hearing.

Brunson’s release could benefit Turkey by allowing the government to focus on an escalating diplomatic crisis over Jamal Khashoggi, a Saudi contributor to The Washington Post who has been missing for more than a week and is feared dead after entering the Saudi consulate in Istanbul. Turkish officials suspect Khashoggi, a critic of the Saudi government, was killed in the consulate; Saudi officials deny it.

Trump maintained the two cases were not linked, saying Brunson’s release amid the Khashoggi investigation was “strict coincidence.”

Turkey may also hope the U.S. will now lift the tariffs on Turkish steel and aluminum imports, a move that would inject confidence into an economy rattled by high inflation and foreign currency debt.

But Brunson’s release doesn’t resolve disagreements over U.S. support for Kurdish fighters in Syria, as well as a plan by Turkey to buy Russian surface-to-air missiles. Turkey is also frustrated by the refusal of the U.S. to extradite Fethullah Gulen, a Pennsylvania-based Muslim cleric accused by Turkey of engineering the failed coup.

Brunson was accused of committing crimes on behalf of Gulen and Kurdish militants who have been fighting the Turkish state for decades. He faced up to 35 years in jail if convicted of all the charges against him.

The pastor, who is originally from Black Mountain, North Carolina, led a small congregation in the Izmir Resurrection Church. He was imprisoned for nearly two years after being detained in October 2016. Brunson was formally arrested that December and placed under house arrest on July 25 for health reasons.

___

Associated Press writer Zeynep Bilginsoy in Istanbul contributed to this report.