WASHINGTON -- House Majority Leader Eric Cantor (R-Va.) lost his seat in Congress Tuesday in a shocking upset to Dave Brat, a college professor backed by the tea party.

With nearly all of the votes counted, Brat had 56 percent of the vote to Cantor's 44 percent.

"I know there's a lot of long faces here tonight. And it's disappointing, sure," Cantor told his glum supporters at his election night party, according to The Daily Caller. "But I believe in this country. I believe there's opportunity around the next corner for all of us."

Cantor had been expected to easily win reelection to an eighth term in Virginia's 7th Congressional District over Brat. Cantor raised about $5.4 million, compared with Brat's $200,000. And as the second-most powerful Republican in the House, Cantor's victory seemed secure. The main question seemed to be how big his margin would be over Brat. No sitting House majority leader has lost since 1899.

Last week, a poll commissioned by The Daily Caller had Cantor's lead slipping, but he was still beating Brat by 13 points.

Cantor's campaign dismissed that poll's lead as ridiculously low, saying the congressman would "win by a much stronger margin." Internal polling showed Cantor up 34 points.

The news hit Republicans in Washington hard Tuesday evening when word spread that Cantor had lost.

"I have to say I don't know of anyone who expected this," said a plugged-in conservative insider who requested anonymity to speak openly. "The shock among people who are supposed to know that world is like nothing I've seen."

At a fundraiser for Rep. Doug Collins (R-Georgia) in Washington, a room full of GOP donors and Hill staffers fell silent when the news circulated.

"The party pretty much ended," one attendee said.

"Pretty much a complete shock," a Cantor ally told The Huffington Post, when asked for comment on the results.

Democrats quickly said the majority leader's loss signaled that the tea party had captured the Republican Party.

"[A]ll the pundits declaring the establishment's victory over the tea party was premature ejaculation," chortled one Democratic lawmaker.

In a statement Tuesday, Democratic National Committee Chair Rep. Debbie Wasserman Schultz (D-Fla.) said, "When Eric Cantor, who time and again has blocked common sense legislation to grow the middle class, can't earn the Republican nomination, it's clear the GOP has redefined 'far right.' Democrats on the other hand have nominated a mainstream candidate who will proudly represent this district and I look forward to his victory in November."

Still, Brat had been Cantor's most serious competitor in years, and the incumbent's campaign was taking him seriously.

Brat, an economics professor and political novice, runs a libertarian-funded program at Randolph-Macon College in Virginia. He ran to the right of Cantor, hammering the congressman for his refusal to rule out immigration reform and his votes to raise the debt ceiling and end the government shutdown.

Cantor tried to hit back by branding his opponent a "liberal college professor" who supported tax increases proposed by former Gov. Tim Kaine (D).

Conservative pundit Erick Erickson said Tuesday that the Virginia results showed the tea party should not be taken too lightly. He added that he didn't think the reason Cantor lost was as connected to his support for immigration reform as might be believed.

"Immigration was the surface reason that galvanized the opposition to Cantor, but the opposition could not have been galvanized with this issue had Cantor been a better congressman these past few years," wrote Erickson. "He and his staff have repeatedly antagonized conservatives. One conservative recently told me that Cantor's staff were the 'biggest bunch of a**holes on the Hill.' ... Cantor lost his race because he was running for Speaker of the House of Representatives while his constituents wanted a congressman."

A Democratic aide who spoke with The Huffington Post largely agreed with this analysis.

"Cantor became detached from his district and frankly was the least likable politician in Congress," said the staffer. "Most people hate Congress but like their particular Member of Congress -- Cantor never met that bar. Erick Erickson was right, the immigration angle is overblown, Cantor never cared about immigration. If anything the GOP Leadership built up expectations on shutting down the government and repealing Obamacare that were inevitably going to come back to bite them. Obamacare is here to stay, everybody knows that, and the monster Eric Cantor helped create came back to destroy him."

A GOP operative also blamed Cantor's staff for his loss: "He fell victim to the political operation he trusted most. It's sad."

Outside groups, including the National Rifle Association and the National Association of Realtors, jumped into the race to back Cantor, while Brat attracted endorsements from right-wing figures like talk show host like Laura Ingraham, who campaigned for him.

Brat had a loud, committed following on the campaign trail, generating an intensity that Cantor failed to muster. During a local GOP convention last month, Brat backers loudly booed Cantor in front of his family.

In a bit of a preview of what was to come, the incumbent chairman of the congressional district's local Republican Party -- also a Cantor loyalist -- was defeated as well by a tea party favorite.

Cantor on Tuesday even lost his home county, Henrico, by almost 7 points.

In a statement, House Speaker John Boehner (R-Ohio) called Cantor "a good friend and a great leader."

"Eric Cantor and I have been through a lot together," Boehner said, adding that he had come to rely on him on a daily basis to make "the tough choices that come with governing."

Brat's competition this fall will be Democrat Jack Trammell, also a professor at Randolph-Macon College.

Jennifer Bendery, Ryan Grim, Sabrina Siddiqui and Jon Ward contributed reporting.

This article has been updated to include the vote results and additional comments.