When there's any question whether Paul Ryan, the U.S. House speaker and 2012 Republican vice-presidential candidate, would win his primary in a carefully sculpted Wisconsin district against a neophyte challenger with ties to the tea party and Sarah Palin, you know the political world is upside down.

The back and forth over whether Ryan would, or wouldn't, endorse his party's nominee, Donald Trump, dominated news coverage for weeks. Ryan, tugging his chin, hemming and hawing, finally did. But then the tables turned with Trump refusing to endorse Ryan while making very nice to his opponent, Paul Nehlen.

Trump did endorse the speaker, tepidly, a few days ago. Ryan won on Tuesday and will likely win in November, putting one Trump-induced crisis behind the party.

The Ryan re-election is one of a number of contests in which incumbents are threatened, either by an unexpectedly strong primary challenger or in the general election, or both, to the point where Republicans may lose their majority in the Senate, and possibly even the House.

Oddly enough, Ryan is the one candidate secure enough to have stood up to Trump and still win. He bucked Trump at first, but then buckled. Yes, there's the cover story of honoring the will of the people who nominated Trump, but Ryan is also thinking ahead. He wants to run for president after four years of Hillary Clinton in the Oval Office and he will need a united party to win.

That explains the calculations taking place across the country. Ryan is like other politicians inspired by, well, politics, more often than principle: The degree to which you are willing to break with Trump depends on how soon, and where, you will be having an encounter with the Republican base he's ignited.

Look at the list of endorsements and defections. The national-security establishment broke with Trump, but they aren't running for anything. Others look safe in their seats without a seatbelt. Maine's senior Republican Senator, Susan Collins, who this week said she wouldn't be voting for Trump in morally serious language, is from a comparatively moderate state where she was soundly re-elected in 2014 and is a favorite to win the governorship should she decide to run for it in 2018.

Contrast that with Sen. Kelly Ayotte's predicament in nearby New Hampshire, where Trump won a resounding victory in February. Ayotte is seeking a second term and is extremely vulnerable. She is running almost neck-and-neck against her opponent, Governor Maggie Hassan, who has high favorables for turning around the economy and accepting Medicaid expansion dollars to fight an opioid epidemic.

Ayotte has broken with conservatives a few times on clean power and paid sick leave, but she's had to defend votes to defund Planned Parenthood, reject new gun background checks and repeal Obamacare. She also is having to defend her refusal to vote on President Barack Obama's Supreme Court nominee.

Ayotte likes Trump about as much as finger-wagging Olympic star Lily King likes her doped-up Russian competitors, but she can't say so. Instead, in a whisper, Ayotte says she will vote for Trump but not endorse him. Or maybe it's the other way around. Whatever helps.

The drama in New Hampshire is nothing compared to the thriller in Arizona, where five-term Sen. John McCain, the party's nominee in 2008, is being challenged in the state's Aug. 30 primary by state senator, osteopath and mini-Trump Kelli Ward.

The party fears that McCain, who beat back a challenge in 2012 by declaring he would "complete the danged fence," could be Cantored, meaning surprised by an unknown tea party-ish challenger, as happened to former House Majority Leader Eric Cantor of Virginia.

To stave off Ward, McCain swallowed his manhood. He supports Trump despite repeated attacks where it hurts — on McCain's heroism (and that of all POWs) — by the non-veteran with five deferments, who also questions McCain's devotion to veterans. That may energize the Hispanic vote against arch-conservative Ward, who favors Trump's wall so much she's offered to pour the "mortar on the border."

After McCain criticized Trump for demeaning the parents of a fallen Muslim soldier, Trump tormented the senator. But Trump ultimately endorsed McCain by reading, like a hostage, a bloodless statement on a card. The free-wheeling candidate who regaled the press corps with apostasies on the Straight Talk Express now tells reporters to drop the subject.

McCain's general-election opponent is Democrat Ann Kirkpatrick, an attorney who gave up a House seat to run for the Senate. She has a simple message: McCain is no longer a maverick. If he won't stand up to Trump, how will he stand up for Arizonans? McCain is pounding on the center-right Kirkpatrick's soft spots, including her support for the Iran nuclear deal and Obamacare.

McCain will likely win his primary, but a victory in the general depends on whether Latinos, who may save him against a Trumpian in the primary, punish him in the general.

The most surprising and heartbreaking example of a strategic Trump endorsement is the announcement by George P. Bush, the Texas Land Commissioner and son of Jeb, that he will support the candidate who beat his father in the primaries.

Has any Bush — or politician — suffered more than Jeb? First George W., the party-boy Bush, wins a governorship and later the presidency that the responsible younger brother was supposed to win, a turn of events that Mother Barbara Bush marveled over. Then Jeb loses a primary in which Trump ridiculed him as low-energy, soft on Mexicans (because he was married to one) and in need of his Mommy to save him in South Carolina. And now this.

Like Ryan, young George P. Bush has his eyes on a bigger prize than family loyalty. He wants to follow Uncle George's footsteps into the Texas governor's mansion.

Politics is sometimes about principle but first it is about politics.