Trump called for plan to remove all US diplomats from Turkey in frustration over detention of American pastor Trump's order came amid a tense dispute over an American detained in Turkey

Washington, D.C. -- Incensed by the detention of American pastor Andrew Brunson, President Donald Trump called for a plan to be drawn up in late August for the complete withdrawal of U.S. diplomatic personnel from Turkey, senior administration and State Department officials tell ABC News.

The unprecedented plan to essentially shutter an American embassy and all diplomatic missions of a NATO ally would have occurred over a 60-day period, starting with the removal of chief diplomats and ending with the eventual drawdown of all diplomatic personnel, according to one senior U.S. official with knowledge of the plan. The plan to remove the diplomats over the two month period was designed to put incremental pressure on the Turkish government.

"For a while, we were in fear of an apocalyptic break in relations with Turkey," a senior State Department official said.

"It would be starting with the chargé [d'affaires] to send a message: 'no personnel left behind,'" the official said. The U.S. has not had an ambassador in Turkey since October of 2017, making the chargé d'affaires the most senior diplomat in the country.

The plan was among half-a-dozen options including increasing sanctions on business and Turkish officials, and its execution would have been more seriously considered if Brunson was not released at his hearing in October.

But Secretary of State Mike Pompeo, who was said to be vocal in opposition to the plan, nevertheless took on the president's order and an eight-page plan was drafted, according to the State Department official. It was so closely guarded and sensitive that few State Department officials dared to even utter that it was a Turkish withdrawal plan. Some referred to it as "the Turkey thing."

The State Department has denied that any such plan was drawn up.

"The assertion that there was a plan to close our diplomatic relations with Turkey or our diplomatic facilities in Turkey is patently false," said State Department spokesperson Heather Nauert.

"As a matter of policy, we never discuss our internal process other than to say that we always consider a full range of options when addressing international responses,” Nauert said. “Mission Turkey is one of our most important posts in Europe. We will continue to devote the necessary diplomatic attention and resources befitting a NATO ally."

A White House spokesperson did not comment on the record.

According to multiple administration officials, Trump was furious with Turkish President Recep Tayyip Erdogan because the president was given assurances that Brunson would be released when the pastor filed an appeal to his house arrest. The appeal was rejected by a Turkish court in August.

"POTUS felt personally betrayed by Erdogan over this issue -- he went back on his word-- it was a personal affront and it made Trump fly off the handle," another administration official told ABC News.

White House Chief of Staff John Kelly suggested the U.S. only remove nonessential personnel from the U.S. missions in Turkey, according to a source familiar. Yet others who had the president’s ear, like National Security Adviser John Bolton, did not oppose the plan for removing all personnel.

Pompeo, who has been one of the president’s most trusted Cabinet members since he took office, expressed the most opposition. According to two administration officials, he argued it should only be a last resort, and that such a move could cause irreparable damage to the relationship with a key NATO ally.

While the plan for full diplomatic retreat was most drastic and drew comparisons among State Department officials who were working on the plan to the American diplomatic relations with Iran and North Korea.

"It took immense effort from Pompeo to slow it down," this official said.

The president’s strong desire to remove U.S. Embassy personnel from Turkey ended when pastor Brunson was released on Friday. He had been detained in Turkey for two years on charges of alleged terrorism and espionage -- part of a wide crackdown by President Erdogan after an attempted military coup in 2016. Brunson and U.S. officials denied the charges.

The president’s orders for a plan to shutter the U.S. diplomatic presence came just weeks after he had levied harsh steel and aluminum tariffs on Turkey, citing national security concerns, which greatly impacted the country’s currency, the lira.

It's unclear if Turkish officials knew the complete extent of the plan, but the State Department source said they felt increased pressure in recent weeks as the president became focused on freeing the evangelical pastor who has become a symbol of religious freedom among his political base.

"The Turks read the outrage across the board. If Erdogan did not let Brunson go at the [October] hearing, it would be unleashed. Sanctions, everything would be on the table, removing diplomats," said a senior administration official.

"The message was sent -- let it be clear, all diplomatic pressure is on the table," the official said.

Brunson's release came amid another diplomatic crisis within Turkey involving the alleged murder of Washington Post journalist and Saudi national Jamal Khashoggi. Turkey alleges that he was murdered by the Saudis and is trying to convince the United States of the same. Turkey has a longstanding rivalry with Saudi Arabia and saw Brunson's release as critical to gaining U.S. support in this separate crisis.

On Saturday, the president met with Brunson in the Oval Office of the White House, where he reiterated that there was no secret deal made with Turkey in exchange for his release.

"We do not pay ransom in this country," Trump said, as he proudly celebrated Brunson's return.