WASHINGTON (AP) — The night before the whistleblower complaint that launched President Donald Trump's impeachment was made public, Democrats and Republicans on the House Intelligence Committee crammed into the same room to get a first look at the document.

For Democrats, it was an instant bombshell, a “jaw-hit-the-floor sort of moment,” one lawmaker said. Another described sneaking peeks at Republican colleagues to see whether they were having a similar reaction.

But the Democrats in the room didn’t get the reaction they were hoping for from Republicans. And through nearly three months of closed-door depositions, powerful public hearings, and procedural posturing, they never would.

The House’s drive toward impeachment ended last week with a party-line vote. Not a single Republican turned against the Republican president, and his grip on the GOP appeared tighter than ever heading into a Senate trial.

There were brief moments when that outcome seemed less certain.

A series of text messages from Kurt Volker, Trump’s special envoy to Ukraine, stirred anxieties in both parties about work being done by Rudy Giuliani, Trump’s personal lawyer, in the Eastern European country. And one by one, State Department officials, including the ousted U.S. ambassador to Ukraine, willingly defied Trump’s orders and provided investigators new details about the scheme.

Even White House advisers conceded they were losing ground in the early days of the impeachment investigation. The administration’s public arguments amounted solely to Trump’s protestations that he had done nothing wrong and that the process was unfair.

But by the time lawmakers streamed into the House chamber last Wednesday to vote on impeachment for just the third time in American history, each side was more hardened in its belief that it was in the right.

This account of how they got there is based on interviews with 21 people directly involved in the matter. Several insisted on anonymity to describe private conversations.

___

It was 7:37 p.m. on a Friday, and most of official Washington had gone home. But Adam Schiff had a subpoena to announce.

In a cryptic statement, released without warning on Sept. 13, the chairman of the House Intelligence Committee revealed that a whistleblower complaint was being withheld from Congress by the acting director of national intelligence, Joseph Maguire.

Schiff, D-Calif., gave no details, but said it was a “matter of urgent concern." Under the law, Democrats said, the administration had no choice but to turn it over.

Even before Schiff’s subpoena, some members of the House Democratic caucus were agitating for Trump's impeachment. Despite House Speaker Nancy Pelosi’s warnings that they did not yet have an “ironclad case," the tally of those in favor of a formal investigation had slowly ticked up.

“I feel like we’re struggling to justify not moving forward,” Rep. Val Demings, D-Fla., told Pelosi on a private Democratic caucus conference call in April, just days after special counsel Robert Mueller issued his findings in the Russia investigation. Mueller said Trump could not be exonerated on obstruction of justice and left it to Congress to decide what to do.

By early September, a group of Democratic House members was so frustrated by the lack of action on impeachment that they were preparing to hold a news conference to challenge Pelosi publicly, according to one lawmaker involved in the effort. They only called off the drastic step when the Ukraine developments emerged and Pelosi signaled she was going to start an inquiry.

In truth, Pelosi had already quietly signed off on stepped-up investigations into Trump. The House Judiciary Committee chairman, Rep. Jerrold Nadler, for example, insisted in August that his committee was in “formal impeachment proceedings.” But it wasn’t clear whether the effort was genuinely impeachment or just an attempt to appease some of the more liberal members of the committee.

Besides, without Pelosi’s public and explicit backing, the impeachment push was going nowhere.

___

By summer, Democratic investigators had taken note of Giuliani’s direct dealings with Ukrainian officials, which he discussed frequently in the media.

The former New York City mayor had for months openly disparaged the American ambassador to Kyiv. All the while, Giuliani promoted uncorroborated corruption allegations against Democrat Joe Biden, the former vice president and current White House candidate whose son Hunter had served on the board of a Ukrainian energy company, Burisma.

On the morning of Sept. 9, three House committees announced an investigation into whether Giuliani was trying to “manipulate the Ukrainian justice system" to help Trump and "target a possible political opponent.” That same afternoon, the House Intelligence Committee received notification about the whistleblower complaint.

In the days that followed, Schiff's staff exchanged letters with Maguire, the intelligence chief, and talked to him directly about the complaint. Democrats decided to go public when it became clear that Maguire wasn’t willing to provide the complaint, according to committee aides.

In the complaint, the whistleblower, who worked at the CIA and been detailed to the White House, raised concerns about Giuliani’s dealings with Ukraine. The person specifically flagged a July 25 phone call Trump had with Ukraine's president, Volodymyr Zelenskiy.

The central charge, to the committee Democrats, was stunning: that Trump had sought help from Ukraine investigating Democrats, including Biden, ahead of Trump's reelection bid, and made a White House visit for Zelenskiy contingent upon Ukraine's willingness to “play ball.” Later, other witnesses would testify that Trump held back military assistance from Ukraine as leverage.

Pelosi, D-Calif., would speak with Trump about the matter hours before launching the impeachment inquiry. He insisted his call with Zelenskiy was “perfect” — a line he would repeat numerous times throughout the investigation.

The speaker vehemently disagreed.

“I was just stunned that the president of United States would engage in such an activity and not even admit that it was wrong,” Pelosi would later tell the AP the day after the impeachment vote. “He had to know it was wrong.”

That afternoon in September, she soberly announced that the House was plunging into an impeachment investigation of the president of the United States.

“The actions taken by the president,” she said, “have seriously violated the Constitution.”
___

As the whistleblower complaint upended Washington, even some of the president’s most ardent allies were on edge.

What had Trump said in the call with Zelenskiy? Who was involved? What had Giuliani been doing abroad? And what had Trump done behind closed doors?

Amid the uncertainty, the White House’s response was muddled. There was little coordinating, no direction offered beyond what Trump doled out on Twitter.

The president himself was irate. For all his criticism of Pelosi, Trump and his advisers have long had grudging respect for her command of the Democratic caucus. They knew she wouldn’t have started the investigation unless she had the votes to impeach.

Yet some in Trump's orbit argued to him that impeachment would virtually assure his reelection, proving to Americans once and for all that Democrats were motivated by little more than their opposition to his presidency.

Trump, however, wasn’t among them. He raged to allies about the all-but-certain stain impeachment would leave on his legacy, not to mention the wall-to-wall news cycles of criticism.

As was often the case in the Trump White House, his team turned on each other at times. Acting White House chief of staff Mick Mulvaney complained he was being shut out of the process. Mulvaney's allies worried that White House counsel Pat Cipollone was angling for his job.

Mulvaney, who had carried out the summertime order to withhold military aid to Ukraine, quickly became a figure of central interest to impeachment investigators. Ordered by the White House to defy a subpoena, Mulvaney briefly considered legal action against the House, but abandoned that idea days later. Democrats still want him as a witness in the Senate's upcoming impeachment trial.

Amid the early chaos, the White House made a decision: It would release a rough transcript of Trump’s July 25 call with Zelenskiy, the one that had spurred the whistleblower complaint. Cipollone and Attorney General William Barr were among those who urged Trump to make the transcript public as a way of bolstering the president’s case that he did nothing wrong.

The transcript was sprinkled with references to Biden and the Democratic National Committee. Trump said Zelenskiy: “I would like you to do us a favor, though.”
____

There was an implicit, if unsaid, directive from Pelosi to her Democrats: Don’t mess this up. There was a sense that Democrats had stumbled by appearing enthusiastic about impeachment, and Pelosi wanted it handled in a somber, serious way.

She put one of her most trusted chairmen, Schiff, in charge of the impeachment investigation. The two consulted often about how to proceed, meeting with other committee heads at least once a week in her office.

From the outset, lawmakers and aides knew that they would have to do the investigation quickly. The goal was always an impeachment vote by Christmas.

They rapidly called in witnesses for private depositions — 17 in all, with 12 eventually testifying in public — who told a largely consistent story of an irregular diplomatic channel in Ukraine as Giuliani became involved and Trump pushed for the investigations of Democrats.

Volker, the Ukraine special envoy, was up first for a closed-door deposition in early October. He brought with him a cache of text messages with other diplomats that plainly revealed that the officials were scrambling to clean up as Giuliani and Trump pushed Ukraine to announce the investigations. The texts gave investigators names of other potential witnesses and a sequence of events.

Democratic lawmakers privately debated whether the committee should release Volker’s texts publicly. One lawmaker urged staff to put them out immediately, before the White House try to classify them retroactively.

The impact of the texts was “seismic,” another lawmaker said. In one of the texts, the top official in Ukraine at the time, William Taylor, said it was “crazy” to withhold military aid from Ukraine for help with a political campaign.

Volker would eventually testify publicly, one of several officials to appear during five days of televised hearings. Lawmakers and aides believed that the decision by Marie Yovanovitch, the former U.S. ambassador to Ukraine, to defy Trump’s orders and testify emboldened other witnesses to appear.

In the public hearings, the witnesses at times seemed made for TV. White House aide Alexander Vindman came in full military uniform to describe his discomfort as he listened into Trump's call. Trump's envoy to the European Union, Gordon Sondland repeatedly described the administration’s dealings with Ukraine as a quid pro quo — one thing in exchange for another. Former White House aide Fiona Hill described a “domestic political errand” that had upended Ukraine policy.

To bolster their case, Republicans moved one of Trump’s most ardent defenders, Ohio Rep. Jim Jordan, onto the House Intelligence Committee temporarily.
___

At first, Trump resisted the notion of a “war room” to organize on impeachment. There were few substantive reasons for that decision, other than Trump not wanting to give Democrats the satisfaction of knowing he was concerned.

But White House advisers knew they needed more defenses; congressional Republicans, after all, were telling them so.

By the time public hearings began, the White House was on steadier footing, ready to launch the same kind of online assault it had perfected during the contentious confirmation hearings for Supreme Court Justice Brett Kavanaugh.

On Nov. 13, the morning of the first open hearing, Mulvaney, Cipollone and senior adviser Jared Kushner walked over to the Eisenhower Executive Office Building to work alongside the nine members of the White House research staff.

As the Intelligence Committee gaveled into session, the research team launched its opening salvo. One, two, ten emails came in quick succession, blasting Democrats and trying to undercut the witness testimony by highlighting their closed-door comments.

The initial flurry was described internally as “shock and awe.” It was meant as a signal to Trump’s Republican allies that it was time to fight back.

Trump’s allies on both ends of Pennsylvania Avenue were now working in tandem. Jeff Freeland, the White House’s point man on the Hill for the hearings, provided guidance to the war room on what Republican lawmakers needed during the hearings.

By the afternoon of the first hearing, the White House believed for the first time it was making progress. Some of the same Republican lawmakers who had been vocally critical of the West Wing effort were using the White House’s talking points in their questions of witnesses.
_____

After two weeks of public hearings, not a single Republican was publicly or privately committed to impeaching Trump. That wasn't an accident.

The top Republican vote-counter, Rep. Steve Scalise of Louisiana, was waging a careful campaign to unify Republicans in Trump's defense, keeping in close contact with members. Weekly impeachment meetings had begun in early October, and they quickly drew a crowd, with Republicans gathering to hear presentations from key lawmakers and Trump allies such as Sens. Lindsey Graham of South Carolina and Ron Johnson of Wisconsin.

Meanwhile, a handful of Democrats were wavering on impeachment, but far from enough to hold off a vote.

Two articles of impeachment seemed sure to pass — abuse of power for soliciting election help from Ukraine, and obstruction of Congress for rebuffing subpoenas for testimony and documents.

But some of the more liberal members of the House Judiciary Committee tasked with drafting the articles wanted a third, based on Mueller’s report. This was the time, they argued, to hold Trump accountable for all of his worst perceived offenses.

But several moderate Democrats opposed the idea, arguing that Ukraine was a cleaner case: Trump had asked a foreign leader to help investigate a Trump political rival and then the president had blocked Congress’ efforts to investigate that.

A group of them — the same freshmen who had written an op-ed that helped tip the scales in favor of impeachment — called Pelosi while she was on a trip to Spain to make the argument for fewer articles.

The articles were introduced later that week. There were only two.

____

On Wednesday, December 18, 2019, Trump was impeached for what Democrats considered “high crimes and misdemeanors” as laid out in the Constitution.

The House voted 230-197 on the first charge, 229-198 on the second, with one Democrat voting "present'' each time.

The articles are expected to eventually head to the Senate for a trial, where he is nearly certain to be acquitted. But Pelosi is waiting to send them, for now, to try and gain leverage for what Democrats consider a fair trial.

Addressing a rally in Battle Creek, Michigan, as the impeachment votes were cast, Trump called the Democrats' actions “depraved” and a “mark of shame.” He said it didn't even feel like he was being impeached.

“He's impeached forever because he violated our Constitution,” Pelosi told the AP. “He gave us no choice.”

Associated Press writers Michael Balsamo, Lisa Mascaro, Laurie Kellman, Jonathan Lemire and Jill Colvin contributed to this report.