And in a year when the Republican establishment was supposed to finally conquer its Tea Party wing, the upstarts wound up with perhaps the biggest victory of any primary season.
David Wasserman, a House political analyst at the nonpartisan Cook Political Report, said another, more local factor has to be acknowledged: Mr. Cantor, who dreamed of becoming the first Jewish speaker of the House, was culturally out of step with a redrawn district that was more rural, more gun-oriented and more conservative.
"Part of this plays into his religion," Mr. Wasserman said. "You can't ignore the elephant in the room."
Mr. Cantor's demise is mildly Shakespearean. Along with Representative Kevin McCarthy of California, Mr. Cantor helped elevate Tea Party candidates in 2010 across the nation by giving them financial and political support, only to be done in by the very type of newcomer he once groomed.
Mr. Cantor can still mount a write-in campaign ahead of the November election, but he would face long odds.
Mr. King said no one saw the defeat coming. Mr. Cantor was spending money, at least $5 million through the middle of May, lining up an array of the Republican consultants and pollsters. He was a prodigious fund-raiser and a well-liked ambassador to many of the party's top donors. Lawmakers thought he was simply trying to run up the score to establish dominance in the district, and he had evinced no concern whatsoever, lawmakers said Tuesday night.
Read MoreSenior republican Cantor suffers shocking loss to Tea Partyrival
Mr. Wasserman predicted "a free-for-all" when House Republicans assemble after November to pick their new leaders. At the least, Mr. McCarthy, the No. 3 Republican, will seek to move up to majority leader, but he also could challenge Mr. Boehner.
More broadly, Mr. Cantor's defeat will embolden conservatives like Representative Tom Price of Georgia, who has openly complained that the leadership positions are occupied by swing-state Republicans.
Candidates to move up could include Mr. Price, Representative Jeb Hensarling of Texas, or brash newcomers like Representative Tom Graves of Georgia, Mr. Wasserman said. The message is that the House must be run by even more conservative leaders.
At the least, Mr. Obama's push for a comprehensive overhaul of the nation's immigration laws now seems even more elusive.
Mr. Cantor's opponent, Mr. Brat, had virtually no money to conduct a true campaign, but he focused on immigration. His megaphone was conservative radio show host Laura Ingraham, who criticized Mr. Cantor's positions on immigration.
"The world just changed," said Stephen Miller, a spokesman for Senator Jeff Sessions, Republican of Alabama and a fierce opponent of the immigration overhaul.
—By Jonathon Weisman and Jennifer Steinhauer, The New York Times