Erdogan had insisted that his country's courts are independent, though he previously had suggested a possible swap for Brunson.

The US 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 US greatly appreciated Brunson's release and said the move "will lead to good, perhaps great, relations" between the US and 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 November 6 elections.

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."

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 while Saudi officials deny it.

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