House Majority Leader Eric Cantor’s stunning primary defeat at the hands of a tea party challenger has thrown the Republican Party into turmoil, and could even threaten the GOP’s future viability as a national party. But it also will badly complicate Democrats’ hopes of getting anything significant through Congress—and perhaps even of keeping the government running effectively—for the rest of President Obama’s tenure.

Close video 'There's a war within the Republican Party' Top Talkers: House Majority Leader Eric Cantor suffered a major loss Tuesday to tea party challenger Dave Brat. The defeat is being called one of the biggest upsets in congressional history. The Morning Joe panel discusses. Top Talkers: House Majority Leader Eric Cantor suffered a major loss Tuesday to tea party challenger Dave Brat. The defeat is being called one of the biggest upsets in congressional history. The Morning Joe panel discusses. share tweet email Embed Ayn Rand-loving economics professor, captured 55.5% of the vote in Virginia’s Republican-leaning 7th congressional district.

Cantor will resign from being majority leader, GOP aides confirmed to NBC News Wednesday.

The shock loss could give Democrats an unexpected pickup opportunity—and it offers more evidence for the Democratic charge that the GOP has been hijacked by extremists.

“Tonight, is a major victory for the tea party as they yet again pull the Republican Party further to the radical right,” House Democratic Leader Nancy Pelosi said in a statement.

Texas Republican Sen. Ted Cruz, a tea party favorite and potential 2016 presidential nominee, appeared to see things the same way. “This election should be a reminder to all in Congress—Republicans and Democrats alike—that the conservative base is alive and well, and the American people will hold us all accountable,” said Cruz in a statement. “Washington needs to listen to the people, stop spending money we don’t have, and stand up and defend the Constitution.”

The ouster of Cantor, who is Jewish, means Congressional Republicans will now be 100% Christian for the first time in decades—making the already homogeneous GOP even less diverse.

But it’s not all good news for Democrats, as GOP lawmakers spooked by Cantor’s loss will be even more wary than they already were about extending a toe across the aisle.

“This could doom any willingness by the Republicans to compromise,” Rep. Steve Israel, who chairs the Democratic Congressional Campaign Committee, said on msnbc Wednesday morning. “Not that they had a willingness before. But this isn’t exactly going to give them a dose of courage on trying to compromise on things like immigration reform.”

Immigration was perhaps the one key issue on which Democrats still held out realistic hopes of progress before the end of the Obama era. Not anymore. The centerpiece of Brat’s campaign was a laser-focus on Cantor’s support for a ”Dream Act”-like proposal to provide a path to citizenship for children who were brought to the United States illegally.

“Eric Cantor is saying we should bring more folks into the country, increase the labor supply—and by doing so, lower wage rates for the working person,” Brat told voters.

Close video Inside Cantor’s collapse Jeff Schapiro and Shira Center explain whether there were warning signs that Eric Cantor would be defeated ahead of Tuesday’s primary. Jeff Schapiro and Shira Center explain whether there were warning signs that Eric Cantor would be defeated ahead of Tuesday’s primary. share tweet email Embed

“Tonight’s election shows the Republican Party has two paths it can take on immigration,” New York Democrat Sen. Chuck Schumer, a key backer of reform, said in a statement. “The Graham path of showing leadership and solving a problem in a mainstream way, which leads to victory. Or the Cantor path of trying to play both sides, which is a path to defeat.”

Another possible 2016 contender, Sen. Rand Paul, a Kentucky Republican, appeared to see things similarly. “I still am for it,” said Paul, a supporter of reform, on a conference call with Grover Norquist, another key advocate of reform. “I say everywhere I go that I am for immigration reform.”

Still, Cantor’s upset loss will undoubtedly be perceived by most of his fellow Republicans, especially in the House, as a cautionary tale about the dangers of moderation on the issue. It’s all but impossible to imagine reluctant conservatives on the lookout for primary challengers giving Speaker John Boehner the space he needs to pass major controversial legislation only days after his top deputy’s defeat.

It’s not just immigration. An emboldened tea party caucus could make it difficult for House leadership to perform the basic functions of government, like passing funding bills and raising the debt limit—something it’s already struggled to do several times over the last few years. It could even make it more likely that Republicans will initiate impeachment proceedings against Obama, which would utterly paralyze Washington into 2017.

Close video Eric Cantor to step down as Majority Leader Ronan Farrow talks to Rep. Chris Van Hollen about breaking news that Rep. Eric Cantor is stepping down as House Majority Leader after a shocking primary loss. Ronan Farrow talks to Rep. Chris Van Hollen about breaking news that Rep. Eric Cantor is stepping down as House Majority Leader after a shocking primary loss. share tweet email Embed

“The next five months is going to be mayhem by the Republican caucus,” said Israel. “ Leadership fights, pandering to their base, political distractions. And that will not serve the American people well.”

Of course, there’s a big silver lining for Democrats. Another two and a half years without immigration reform figures to worsen the GOP’s already dire problem with Hispanic voters. If Mitt Romney struggled in 2012 to court Hispanics while still opposing reform, that needle will likely be even tougher for the party’s 2016 nominee to thread. Ultimately, Republicans may well be doomed in the long run as a major party if they don’t improve their standing with the fastest-growing segment of the electorate.

“The results tonight will move the party further to the right, which will marginalize us further as a national party,” Rep. Peter King told the New York Times.

But as the economist John Maynard Keynes said, in the long run, we’ll all be dead. And in the meantime, thanks to Tuesday night’s remarkable events in Virginia, things could get pretty ugly.

Benjy Sarlin contributed reporting.