Click here for the latest story on the fallout from Eric Cantor’s upset.

House Majority Leader Eric Cantor (Va.), the chamber’s second-ranking Republican, was badly beaten in a primary contest Tuesday by an obscure professor with tea party backing — a historic electoral surprise that left the GOP in chaos and the House without its heir apparent.

Cantor, who has represented the Richmond suburbs since 2001, lost by 11 percentage points to Dave Brat, an economist at Randolph-Macon College in Ashland, Va. It was an operatic fall from power, swift and deep and utterly surprising. As late as Tuesday morning, Cantor had felt so confident of victory that he spent the morning at a Starbucks on Capitol Hill, holding a fundraising meeting with lobbyists while his constituents went to the polls.

1 of 29 Full Screen Autoplay Close Skip Ad × A look back at Eric Cantor’s time in Congress View Photos The House majority leader was ousted by his primary opponent in a stunning loss Tuesday. Caption The House majority leader was ousted by his primary opponent in a stunning loss Tuesday. Sept. 27, 2008 Rep. Eric Cantor (R-Va.) holds up a statement by then-House Speaker Nancy Pelosi regarding a $700 billion financial rescue plan that failed to pass the House, as John A. Boehner (R-Ohio), who was the House minority leader, listens. Mark Wilson/Getty Images Buy Photo Wait 1 second to continue.

By Tuesday night, he had suffered a defeat with few parallels in American history. Historians said that no House leader of Cantor’s rank had ever been defeated in a primary.

That left stunned Republicans — those who had supported Cantor, and even those who had worked to beat him — struggling to understand what happened.

Several said they believed that Cantor had mismanaged his campaign, with a strategy in which he was too aloof and his tactics too aggressive. In Virginia, some Republicans perceived him as having grown removed from his 7th Congressional District, spending too much time on national fundraising and Washington infighting.

“Cantor’s field effort was nonexistent. You didn’t see a heavy Cantor presence at Shad Planking, one of the premier Virginia GOP events, and the movers-shakers in the group he works with, YG Virginia, did not have the staff to fully compete,” said Andrew Xifos, a Virginia Republican organizer. “Brat was always an afterthought to them, even as they spent a lot of money. Central Virginia politics was changing around them and they did not see it.”

Then, some strategists said, Cantor compounded his problems with a blitz of TV ads that attacked Brat, 49. Cantor was apparently intending to bury his underfunded challenger, but the strategy backfired.

“It gave [Brat] oxygen and it gave him sympathy. It was just a tactical mistake,” a Virginia Republican strategist said. “That’s when Brat went from being a guy that die-hard tea party people had heard about to being a guy that just ordinary conservatives driving around and listening to talk radio had heard about.”

Brat was boosted for months by conservative talk-radio hosts, including Laura Ingraham and Mark Levin, who touted him as a contender to their listeners and drove small-dollar donations into Brat’s coffers.

Unhappy with what they considered a too-hesitant-to-fight GOP, they championed Brat as a fellow warrior for an ideological cause, lifting him with the GOP’s base as he hovered under the national radar.

When Election Day came, the turnout was high: About 65,000 people voted, which was up from 47,037 two years ago (when Cantor captured 79 percent of the vote).

After the race had been called, Brat spoke to cheering supporters in the atrium of a nondescript building at an office park. He told them that he had won by adhering to conservative principles.

“I love every single person that God made on the planet because they’re all children of God,” he said. He returned to a tea party tenet, talking about the need to control government spending: “It’s not a punchline, it’s called fiscal responsibility.”

His victory means that Cantor cannot get on the ballot in Virginia this fall. Brat will face Democratic nominee Jack Trammell — another professor at Randolph-Macon. Cantor’s only option would be a hard and humiliating one: to run as a write-in candidate, in the district he dominated for 13 years.

At Brat’s party, it was clear that Republicans were already moving on. As soon as he finished his speech, Virginia Republican Party Chairman Pat Mullins walked over to the microphone and pledged his support for the general election campaign ahead. The establishment was behind the insurgent.

“Anything you need, you call me and we’ll get it,” he said to Brat. The crowd members shouted their praise.

In Richmond, Cantor’s would-be victory party went from somber to surreal.

“I know there’s a lot of long faces here tonight,” Cantor told the crowd, appearing just after the race had been called about 8 p.m. “It’s disappointing, sure. But I believe in this country. I believe there’s opportunity around the next corner for all of us.”

He spoke for about four minutes, thanking his supporters and saying he would continue to “fight for the conservative cause.” He then quickly exited the ballroom and got into a waiting SUV, ignoring questions from reporters.

Then things became rowdy. A group of immigration activists suddenly stormed the ballroom, screaming and waving a flag. “What do we want? Immigration reform! When do we want it? Now!”A few Cantor supporters tried to block them, and there was pushing and shoving. One supporter threw his glass of wine onto a female protester. She swore at him in return.

A hotel employee took the microphone to warn, in Spanish, that the police were on their way. The police did come, and the protesters left. As they walked through the parking lot afterward, a Cantor supporter shouted, “Get a job!”

In Washington on Tuesday, the idea of Cantor’s loss was so strange that there was no plan in place to deal with it. Other Republicans puzzled: Did Cantor have to resign his position as the House Republican leader immediately?

“This is an earthquake,” said former congressman Vin Weber (R-Minn.), a friend of Cantor. “No one thought he’d lose.”

On Capitol Hill, Cantor’s defeat will create enormous uncertainty in the House. Cantor, 51, had been considered the next generation’s GOP leader, who would take over for House Speaker John A. Boehner (Ohio) when Boehner, 64, retired. In a caucus deeply divided between establishment Republicans and fire-breathing conservatives, these were the two who had shown some ability to keep order.

Now, there is no heir. And there may be no order.

If Boehner does stay on — defying retirement rumors — he may find it even harder to unite his fractured party on issues such as immigration and federal spending. On Tuesday night, Boehner came out of an Italian restaurant on Capitol Hill with his tie loosened, and found reporters waiting for him.

Did he have a comment? “No,” he said, and he left. Boehner later issued a statement that called Cantor “a good friend and a great leader.”

“My thoughts are with him and Diana and their kids tonight,” he said in the statement.

If this is the end of Cantor’s political career, he may become a cautionary tale on Capitol Hill. He had tried to please both of the GOP’s warring wings, the staid establishment and the confrontational tea party movement.

In the end, that approach brought him power, but not enough loyalty to keep it.

The dour and businesslike Cantor had embraced confrontation enough to alienate some establishment types — in particular, by showing pique in negotiations with President Obama over a budget deal.

But he also had made moves that alienated the party’s confrontational wing. Cantor, for instance, had championed a Republican version of the Dream Act, which would enable some illegal immigrants who entered the country as children to qualify for in-state college tuition rates. Although he never brought the legislation to the House floor, his support for the idea irritated staunch opponents of immigration reform.

For other Republicans in Congress, the message of the defeat was that if you try to play both sides of the intra-party divide you will lose. But how Republicans can govern without bringing both sides together remains a question.

“I don’t know where we go now as a party. I’m very concerned that we may go all the way to the right, following Ted Cruz and the shutdown congressmen, and marginalizing us as a responsible governing party,” Rep. Peter T. King (R-N.Y.) said on Tuesday night.

“We knew Eric spent a lot of money and we all thought he was just wrapping up a good win,” King said. “I don’t think he thought he was in trouble. Word was going around tonight around members and it was disbelief.”

Mike DeBonis, Rosalind Helderman, Laura Vozzella, Jenna Portnoy, Rachel Weiner and Victoria St. Martin contributed to this report.