EL PASO, Texas ― The question for many political observers as polls closed Tuesday in perhaps the nation’s most closely watched Senate race was not whether rising Democratic star Beto O’Rourke would lose, but by how much.

The answer, according to the unofficial final tally: not quite 2.7 percentage points.

While throngs of his disappointed supporters mourn his loss to incumbent Republican Ted Cruz, the larger theme for the state’s Democratic Party is not that Texas remains under conservative control, but that the margin by which Republicans won the Senate race and some other key contests was far narrower than anyone would have expected not so long ago.

ASSOCIATED PRESS Democrat Beto O'Rourke lost his quixotic bid to unseat GOP Sen. Ted Cruz in Texas. But O'Rourke's run left his party in a far better position to compete in the state down the road.

Attorney General Ken Paxton won by 3.6 points; Lt. Gov. Dan Patrick triumphed by less than 5. These two incumbents won their races four years ago by margins of more than 20 points, and their opponents this time were hardly political juggernauts.

And even as popular Gov. Greg Abbott cruised to re-election, his underfunded and uninspiring opponent, former Dallas County Sheriff Lupe Valdez, still winnowed the gap from Wendy Davis’s 20-point obliteration in 2014 to a less atrocious 13.4-point spread.

Democrats also actually won two key races, ousting previously entrenched GOP incumbents in two U.S. House districts ― one in the Houston area, the other part of the Dallas metroplex.

None of this is good news for Texas Republicans. Heading into 2020, the state is now far more competitive than it has been in at least a generation. And O’Rourke, at the start of the year an obscure House member from El Paso, gets the credit.

“The long-lasting impact that he will have is that more very high-quality (Democratic) candidates will choose to run and I think more Texans will believe that their votes will really count,” Austin City Councilman Greg Casar told HuffPost. “And now nationally, people really have to talk about Texas as a purple state.”

Underlying reasons at work before O’Rourke’s emergence help explain the trend. State Democratic officials are quick to point out that their efforts to mobilize low-propensity voters began years ago. Nonprofit groups ― including several nonpartisan ones ― have also amped up that work in a state where turnout rates lag, especially among Hispanics.

Democrats made a point of contesting more congressional races this year, upping the stakes for voters. The Texas electorate is also becoming younger, more urban and more diverse. All of that favors Democrats.

But the catalyst was undoubtedly O’Rourke.

“Essentially, there was a ... blue wave” inspired by support for O’Rourke and antipathy toward President Donald Trump, Rice University political scientist Mark Jones told HuffPost.

“Beto O’Rourke, barring a miracle, was always going to lose,” Jones added. “The question was, could he narrow the margin of defeat to a low enough number that he could create enthusiasm for Democrats looking to the future?”

Associated Press Texas Attorney General Ken Paxton won by a landslide in 2014. On Tuesday, he held onto his seat by 3.6 percentage points.

That effect played out across the ballot. Along with the two House seats they flipped, Democrats nearly picked up a third ― Rep. Will Hurd, a moderate Republican (and a good friend of O’Rourke’s), appears to have eked out a win by fewer than 1,200 votes. His challenger, Gina Ortiz Jones, has refused to concede until the absentee ballots are all counted.

In the state legislature, Republicans held onto strong majorities but lost two Senate seats and a dozen in the House. State Rep. Matt Rinaldi, who famously called Immigration and Customs Enforcement to report undocumented activists at the Capitol last year, was among the losers. It wasn’t an isolated result. Some of the most polarizing movement conservatives either lost or saw their margins of victory decrease.

“The biggest lesson is that Republican candidates who have a profile of being more reasonable and less polarizing did significantly better than candidates seen as less flexible and more polarizing,” Jones said.

With the state’s biennial legislative session set to start in January, that development will make it harder for hardline conservatives like Patrick to marshal an ideologically driven agenda ― as he did last year when the lieutenant governor relentlessly pushing for transgender bathroom restrictions. (The measure ultimately failed.)

But the bigger takeaway is that the Texas Democratic Party officials already are much more confident as they look toward 2020. They’ve already seen a flurry of interest in candidate recruitment for next cycle, according to party communications director Manny Garcia. They’ll clearly target GOP Sen. John Cornyn’s seat.

The impact of O’Rourke’s underdog campaign stretches beyond losing by fewer points. His aggressive ground game, anchored by his visits to each of the state’s 254 counties, offered a new model for spurring enthusiasm. He leaves the state party with a healthier infrastructure and a battalion of volunteers who saw their work make an unlikely impact.

And by coming within striking distance of defeating Cruz, lifting a lackluster statewide ticket in the process, O’Rourke demonstrated to donors within the state and beyond that Texas Democrats are worth investing in.

Some Democrats in tight races across the country grumbled ahead of Election Day that O’Rourke didn’t spread the more than $70 million in small donations that he amassed for what was all but sure to be a losing run. But prominent Texas Democrats have complained for years that the national party treats the state like an ATM, descending upon it to gather funds for candidates in swing states.

“On Election Night in 2016, Democrats in San Antonio, Houston and Dallas were making phone calls to Iowa and Ohio” to try t help the party in those states, Garcia said. “I think what that (O’Rourke’s campaign) shows is that if we keep our volunteer capacity here, if Texans talk to Texans and Texas donors fund Texas candidates, we will win this state.”

Of course, what remains to be seen as Texas Democrats move forward is whether others can replicate O’Rourke’s success.

As a bilingual and bicultural border resident, he connected with Hispanic voters on health care, immigration and his support of veterans. Unencumbered by an internal pollster to moderate his commentary, O’Rourke freely ad-libbed at his numerous town halls and campaign rallies ― often going viral when taking on contentious cultural issues, most famously when defending National Football League players who take a knee during the national anthem to protest racial injustices.

Unrelentingly optimistic in the face of polarization, O’Rourke’s greatest struggle was answering and leveling attacks against Cruz, a skilled debater and former solicitor general.

That combination of qualities is unusual. Dallas-based Democratic state Rep. Rafael Anchia compared O’Rourke on the stump favorably to the likes of Bill Clinton and Barack Obama.

“There’s only one Beto, but there will be others that emerge,” Anchia said. “Permitting people to believe removes the greatest obstacle.”