After months of negotiations on the release of Pastor Andrew Brunson, an American who was held in a Turkish prison on terrorism charges since 2016, U.S. Secretary of State Mike Pompeo seemed content. Before his combative appearance on Capitol Hill in the same morning, a Turkish court finally had moved Brunson to house arrest. An excited Pompeo presented this as an indicator of "diplomatic progress" in his opening statement. "Our work is not done, but it's a welcome progress," he said.

Two days later everything went south. On Thursday, U.S. Vice President Mike Pence issued an ultimatum of economic sanctions against Turkish officials during a conference on religious freedom by the State Department, in which dozens of countries with flawed track records attended, but Turkey wasn't invited. Trump followed up the threatening messages directly addressed to Turkish President Recep Tayyip Erdoğan with a tweet.

Pompeo was blindsided by the harsh language, because he was in "delicate negotiations" with Turkey, according to two American officials who spoke to a long-time diplomatic reporter based in Washington.

Turkish officials were puzzled. For months, Turkish Foreign Minister Mevlüt Çavuşoğlu and Turkish Intelligence Agency (MIT) Chief Hakan Fidan have been negotiating a deal with Secretary Pompeo on Brunson. Turkish officials wanted Mehmet Hakan Atilla, a former deputy general manager of Halkbank, who was sentenced in New York for violating Iran sanctions in May.

After intensive discussions, Americans agreed that Atilla could be moved to a Turkish prison where he would serve his remaining sentence and there wouldn't be additional prosecution of the bank. Turks, on their end, could deport Brunson.

Several Turkish officials and sources, who closely followed the negotiations, said everything was going as planned. Brunson was going to wait for his final release during a house arrest. There was a road map; until Pence came up with an idea.

"He wants to play the evangelist card in the mid-term elections," said a Washington source. Many Republican seats in U.S. Congress are up in November, and holding the majority in Senate is essential for Trump administration.

"I bet Evangelist Pence was pissed that, his counterpart Prime Minister Binali Yıldırım is out and no one was asking Pence anything anymore. He probably wanted to be an actor in this affair and somehow convinced his boss as well," a Turkish official sighed.

For many, this is a likely scenario. Trump is known for his impulsive decision without taking advice from his closest aides. "Ibrahim Kalın, Erdoğan's chief foreign policy adviser, has discussed the Brunson deal with Trump's National Security Adviser John Bolton on three occasions. And all of them were supportive. There was no hint of ultimatums," according to a high level Turkish presidential source.

Congressional leaders who have been campaigning for Brunson's release were also surprised by the White House ultimatum, a BuzzFeed report said Thursday.

Turkish officials contest the White House account leaked to American media, that Trump had brokered Turkish citizen EbruÖzkan's release in Israel in return of Brunson, and Turks didn't honor the deal and kept upping the ante. A White House official, speaking on condition of anonymity, told Daily Sabah that Turkey missed a real opportunity.

Several Turkish officials say Özkan was never part of the deal and they were two separate tracks. "Yes, it is true that Erdoğan asked Trump's help for Özkan. But this had nothing to do with Brunson. Those two were separate topics of discussion," one of the Turkish officials said.

"By heeding Pence's advice, Trump is risking the loss of a friendly country. He pushed the crisis to a level that fixing it has become almost impossible," a senior Turkish official said. "Had he listened to Pompeo, he could have welcomed Brunson in Joint Base Andrews and become a real hero for his constituency. He really missed a 'real opportunity.'"

Trump and Erdoğan were fist-bumping just earlier this month at NATO summit in Brussels, American media were depicting both as frat boys socializing at the aghast of European leaders. Both leaders spoke on phone on Thursday, before everything went south. Both American and Turkish officials refuse to discuss what transpired between them during the call.

Turkish officials, however, think there is still a way out: Trump should return to negotiations by empowering his secretary of state.

"Trump should stop tweeting and stop following Pence's opportunistic ill-advice. He just needs to take a back seat and allow negotiations to continue" the senior official said.

After all, Erdoğan didn't issue any public response to Trump's threats. It seems there is still some room for a diplomatic exit.