Update 11/11/2019: This story has been updated to include comments from Fareed Zakaria.

WASHINGTON — Ambassador Bill Taylor spent early September racing to stop a “nightmare” scenario from unfolding: the president of Ukraine announcing a politically explosive investigation of Joe Biden on CNN at the U.N. General Assembly in New York.

Taylor’s “nightmare” might have become a reality — if President Trump’s pressure campaign hadn’t become public thanks to a whistleblower.

That’s because as recently as early September, Trump’s administration had been withholding military aid as a tool to pressure Ukrainian President Volodymyr Zelensky into announcing politically helpful investigations for Trump, according to Taylor’s testimony.

Taylor, a career foreign service officer, said he'd spent the better part of the summer battling a “shadow foreign policy” led by Rudy Giuliani, Trump’s personal attorney. That fight culminated in a mad scramble to keep Ukraine’s president from doing an on-camera interview with CNN during the United Nations General Assembly meetings in late September to announce investigations against Trump’s potential 2020 opponent, Joe Biden.

Giuliani was instrumental in pushing dubious conspiracy theories about Joe Biden and his son Hunter into the State Department’s dealings with Ukraine, with the apparent goal of getting the country to act on them, according to testimony.

Taylor said it was his “clear understanding” that the administration was holding up military assistance as a means to pressure Ukraniian officials, including Zelenksy, into launching an investigation into Biden and the 2016 election. He knew that, he said, because U.S. ambassador to the European Union Gordon Sondland had told him that in no uncertain terms — and said it came from Trump.

Ukrainian officials, meanwhile, were aware of the hold on military aid by the beginning of August, though they weren’t told explicitly that it was connected to the administration’s demands for a public statement on the Bidens until a month later. That arrangement was directly messaged to them by Sondland in a Sept. 1 meeting.

Taylor testified that Sondland had told him on Sept. 8 that “the Ukrainians had agreed to do a CNN interview.”

That same day, Taylor threatened to resign, texting Sondland and U.S. envoy to Ukraine Kurt Volker that “The nightmare is they give the interview and don’t get the security assistance. The Russians love it. (And I quit.)”

“My fear at the time was that, since Ambassador Sondland had told me President Zelensky had already agreed to do a CNN interview, President Zelensky would make a statement regarding investigations that would have played into domestic U.S. politics,” Taylor testified to the House impeachment inquiry.

The White House ultimately released the military aid on Sept. 11, but only after bipartisan outcry and two days after the House began an investigation into Trump’s conduct toward Ukraine. By then, Congress was already working to uncover the whistleblower’s complaint, but hadn’t seen its actual contents.

On September 13, two days after the aid was released, Zelensky was scheduled to appear on CNN's Fareed Zakaria GPS, according to the New York Times, in which he was expected to make an announcement. Zakaria said Sunday that Zelensky had "agreed in principle" to an interview in mid-September and that the two sides were working out logistics, but Ukraine "pulled the plug on the planning" after the whistleblower's complaint surfaced.

But that same day, Taylor told Zelensky and one of his top aides that bipartisan support in Washington was Ukraine’s “most valuable strategic asset” and warned him: “Don’t jeopardize it.” But he wasn’t confident that would happen. “The body language was such that it looked to me like he was still thinking they were going to make that statement” at the U.N., he said.

Trump and Zelensky finally met face-to-face at the U.N. on Sept. 25. It was awkward, as Zelensky struggled mightily to avoid getting drawn deeper into the now historic scandal. Had it not been for the whistleblower, he might have been doing just that — at Trump’s demand.