Washington (CNN) -- To understand how messed up Republican politics are these days, examine two votes in Congress this week that demonstrated the level of GOP dysfunction amid the confusing dynamics of an election year in Washington.
On Tuesday, House Speaker John Boehner and 27 other Republicans voted to allow the federal borrowing limit to increase, joining nearly unanimous Democratic support to pass the debt-ceiling measure over the opposition of the other 199 GOP members.
The next day, Senate Minority Leader Mitch McConnell and 11 GOP colleagues voted with the Democratic majority to reject an attempted filibuster of the same legislation by fellow Republican Sen. Ted Cruz of Texas.
Minutes later, all 12 of the GOP senators who helped defeat the filibuster bid voted with Cruz and the rest of the Senate Republicans against final approval of the debt-ceiling plan, which passed anyway due to unanimous Democratic support.
In other words, Republican leaders in Congress sided with Democrats to push through legislation opposed by most of their colleagues. In the Senate, they then voted against the proposal that their earlier support ensured would pass.
Election year politics
Here's the really strange part -- it all makes sense, at least in the context of a divided Republican Party less than nine months before congressional elections in which every House seat and 36 of the 100 Senate seats will be contested.
The situations in the House and Senate differed in specifics but shared a common root -- more extreme conservatives foiled plans by GOP leaders to avoid a politically damaging showdown over the debt ceiling while still registering Republican opposition to increased federal borrowing.
According to public statements, nobody wanted another debt-ceiling stalemate like those of the past three years that unsettled financial markets and caused the first downgrade of the U.S. credit rating in 2011.
A recent CNN/ORC International poll found that 54% of respondents would blame congressional Republicans for a failure to raise the debt ceiling, while 29% would blame President Barack Obama and 12% would blame both.
Fresh memories of public blame for the 16-day government shutdown in October also motivated Republican leaders to try to steer clear of another standoff.
However, conservative disdain for anything smelling of more federal borrowing -- especially in an election year -- torpedoed Boehner's efforts to forge a compromise that would include some deficit-reduction provisions.
His final attempt was to tack on a politically popular proposal that repealed cuts to military pensions in the recent budget agreement. When Boehner's caucus rejected it, the Ohioan decided to violate his own rule by holding a vote on a "clean" debt-ceiling plan with no accompanying spending cuts, which passed on Tuesday because of strong Democratic support.
The House result offered McConnell a face-saving chance to avoid any Senate Republicans from having to vote for the debt-ceiling measure. He and other GOP leaders urged their colleagues to let Democrats pass the House version while Republicans opposed it, but Cruz's filibuster bid meant that at least five GOP votes would be needed to prevent another Washington impasse.
In a dramatic moment Wednesday on the Senate floor, McConnell and fellow GOP leader Sen. John Cornyn of Texas cast the two votes needed to reach the threshold of 60 to overcome the filibuster attempt. Other GOP colleagues then changed their votes to provide some political cover, but the damage was done.
Both McConnell and Cornyn -- longtime conservatives considered Obama's harshest Senate foes -- face primary challenges from further to the right this year. Shortly after Wednesday's votes, the campaign of McConnell's primary opponent in Kentucky, tea party conservative Matt Bevin, highlighted how the senator helped defeat the filibuster against the debt limit measure.
Some GOP colleagues praised Boehner and McConnell for putting party welfare ahead of personal political risk.
"It was a very courageous act, especially Sen. McConnell, who we all know is in a very tough race," said GOP Sen. John McCain of Arizona, one of the Republicans who changed his vote to help overcome the filibuster bid. "He's the elected Republican leader and it's up to him to cast the right vote."
Fellow Republican Sen. Mike Johanns of Nebraska said the debt-ceiling issue had to be resolved to prevent harmful financial and political fallout.
"That's just the reality," he said. "You can deal with it with 60 votes or a majority, but at the end of the day, you had to deal with it."
Cruz was unapologetic, attacking his fellow Republicans and Democrats as unresponsive to the rising federal debt.
"Today was a classic victory for Washington establishment interests, and the people who lost today were the American people," he said.
As expected, Democrats offered a different assessment.
"A real civil war"
"It is encouraging that some of my Republican colleagues seem to be regaining their grip on sanity this week," Senate Majority Leader Harry Reid said before Wednesday's votes, while fellow Democratic Sen. Claire McCaskill of Missouri told MSNBC that Republicans have "a real civil war on their hands."
"They have rigid ideologues that are pushing a very narrow agenda, a very narrow view of what America is, and then they've got a lot of Republicans that are not that extreme, and they're in a big battle right now," she said. "And you see it every day around here."
To CNN Chief Political Analyst Gloria Borger, Cruz put his own agenda of appealing to the tea party right ahead of the GOP leadership's strategy.
She noted he did the same thing to cause last year's government shutdown by trying to link federal spending to efforts to dismantle Obama's signature health care reforms, which conservatives detest.
Republicans still smarting from that defeat "are looking at Ted Cruz today and going, 'Oh my God, didn't you learn the lesson of the government shutdown?'" Borger said, adding that "it's about him."
CNN's Dana Bash, Ted Barrett and Paul Steinhauser contributed to this report.