Beto O’Rourke fell short Tuesday in his quest to oust Republican Sen. Ted Cruz, but by coming within a few points in deeply conservative Texas and building a national fundraising machine, he emerged as a major player in the Democratic Party heading into 2020.

O’Rourke was among a handful of high-profile Democrats who fell to defeat Tuesday after igniting Democratic hopes that they could make inroads in Republican territory. In Florida, Tallahassee Mayor Andrew Gillum lost a hard-fought race for governor against Republican Ron DeSantis. And in Georgia, Democrat Stacey Abrams appeared to be getting clobbered by Republican Brian Kemp in an election marred by widespread voting problems.

But O’Rourke’s surprisingly strong performance was the best in decades by a Democratic Senate candidate in Texas. With 60 percent of precincts reporting, O’Rourke was trailing Cruz by just three percentage points, outperforming Hillary Clinton’s showing against Donald Trump in the 2016 presidential campaign.

O’Rourke also sparked an enthusiastic movement that appeared to help boost support for Democrats in key House races in the suburbs of Houston and Dallas and along the Mexican border.

In Dallas, Democrat Colin Allred, a former National Football League player, unseated Republican Rep. Pete Sessions, a powerful House veteran who had represented the district since 2003. In Houston, Democrat Lizzie Pannill Fletcher held a narrow lead over Republican Rep. John Abney Culberson in a district the GOP had also held for decades.

Along the border, Democrat Gina Ortiz Jones was making a surprisingly strong showing against Republican Rep. Will Hurd. And in the El Paso district O’Rourke represented, Democrat Veronica Escobar won with a commanding margin.

O’Rourke’s campaign, which drew enthusiastic crowds to massive rallies featuring such stars as country legend Willie Nelson, had attracted attention across the nation. “Beto for Texas” gear became a fashion statement in progressive circles. In the tense and shifting political sea where seemingly anyone with enough star power could mount a credible 2020 presidential campaign, there were whispers that O’Rourke, a congressman since 2013, could rise in a scattered Democratic field.

In addition to his charisma on the campaign trail, O’Rourke demonstrated the kind of fundraising prowess essential for a presidential bid, raising $38 million between July and September — part of a record $70 million haul.

In the end, the mountain proved too tough to climb. A Democrat has not won a statewide office in Texas since 1994. Self-identified Republican voters significantly outnumbered Democrats at the polls on Tuesday by 41 percent to 31 percent, according to Election Day surveys by AP VoteCast.

And though O’Rourke enjoyed a narrow advantage over Cruz with independents, it was too little to overcome the strong Republican lean of the Texas electorate. O’Rourke received just 8 percent support among Republicans.

O’Rourke made it a point to visit all 254 counties in Texas. His strategy focused on turning out young voters, who make up a notoriously small portion of the electorate, capturing moderates and “Never Trump” voters, and emphasizing a pointed message of inclusivity and positivity in an era of bitter partisanship.

Still, O’Rourke was up against a formidable star from across the aisle in Ted Cruz, a former presidential candidate and Trump rival who has become one of the president’s closer allies.

“Tonight is a victory for the people of Texas,” Cruz told supporters after the returns were in. “This election wasn’t about me, and it wasn’t about Beto O’Rourke. This election was a battle of ideas . . . and the people of Texas decided.”