The tea party failed to beat the vulnerable Sen. Pat Roberts of Kansas, but it did fend off an establishment challenge against two influential House members. The big takeaway: candidate quality matters.

But the news wasn’t all bad for the tea party in Tuesday’s primaries. Another Michigan congressman, libertarian-leaning Rep. Justin Amash (R), survived a spirited challenge by a business-backed candidate, and conservative firebrand Rep. Tim Huelskamp (R) of Kansas beat back a surprisingly strong challenger.

For both sides of the Republican civil war, Tuesday’s primaries provided important lessons:

Candidate quality matters. Three-termSen. Pat Roberts (R) of Kansas was totally beatable. He seemed the epitome of the tired, aging incumbent who had lost touch with his home state. When Senator Roberts acknowledged that he didn’t own a home in Kansas and rented a room from supporters when he was in town, he seemed doomed. But the best his GOP opponents could come up with was a first-time candidate with an old Facebook page that proved politically fatal.

Radiologist Milton Wolf had plenty going for him. He’s young and telegenic and had milked his distant family connection to Mr. Obama effectively. (They’re second cousins once removed.) A doctor who wanted to overturn Obamacare made for catchy ads. Then Dr. Wolf’s Facebook page resurfaced, featuring X-rays of injuries and inappropriate comments. His campaign tanked.

Over time Wolf regained momentum and lost to Roberts by only 7 percentage points. A stronger challenger, perhaps one of Kansas’ sitting House members, likely would have beat him. Instead, the tea party looks set to finish primary season having defeated no incumbent GOP senators in the primaries for the first time since the movement launched.

Anyone can get elected to Congress once. Rep. Kerry Bentivolio (R) of Michigan was often referred to as “the accidental congressman.” He won the seat in 2012 after the then-occupant of the seat, Thaddeus McCotter (R), inexplicably failed to turn in enough signatures to qualify for the ballot.

Congressman Bentivolio’s colorful résumé – including Santa Claus impersonator and reindeer farmer – made him easy to lampoon. But it was really his provocative comments that made him a target for an establishment takedown. A year ago, he said impeaching Obama would be “a dream come true,” and revealed that he had acted on that dream.

The White House and Democrats love impeachment talk, especially from a sitting GOP member of Congress. It gives them a foil to make the whole party look extreme. With the backing of Michigan native son Mitt Romney, foreclosure lawyer David Trott dispatched with the freshman Bentivolio Tuesday by a 2-to-1 margin.

What doesn’t kill you makes you stronger. Tea party groups seem especially proud of the victories by Congressmen Amash and Huelskamp. Both are two-term members who won their seats in 2010 – the first election of the tea party era – and establishment Republicans had hoped to take them out before they became fully entrenched.

Amash is identified more as a Ron Paul-esque libertarian than tea party, but the end result is the same. Business interests wanted him out and rallied around his opponent, businessman Brian Ellis. The big money rolled in, most notably from the local, state, and national chambers of commerce. Club for Growth, the most-moneyed of the outside groups that back tea partyers, came in for Amash.

Dubbed “Dr. No” by establishment Republicans over his tendency to vote against legislation that he sees as fiscally irresponsible, Amash has been a thorn in the side of the House Republican leadership since he took office in 2011. And he doesn’t mince words. In his victory speech Tuesday night, Amash didn’t make nice with the man he had just defeated by 15 points.

"I ran for office to stop people like you,” said Amash, after rejecting a congratulatory call from Ellis.

Huelskamp’s strong challenge from farmer and former teacher Alan LaPolice was late-breaking but in a way not surprising. Huelskamp is another outspoken conservative who opposed Republican John Boehner’s reelection as speaker in 2013 and was removed from key committees.