House Speaker John Boehner didn't always lose his constant battles with the Republican right, but he didn't win most of them either.
So after more than four and half a years of a very difficult tenure, constantly at war with an angry bloc of deeply-conservative members, Boehner announced his decision to step aside on Friday.
It was an acknowledgment that he was never going to get Republicans on Capitol Hill or around the country behind his vision for the GOP. Conservatives like Texas Sen. Ted Cruz were thrilled that Boehner opted to step down and even some more moderate figures in the party were ready to see him go.
"It's not about him or anybody else, and I'm not here to bash anyone, but the time has come to turn the page, the time has come to turn the page and allow a new generation of leadership," Florida senator and 2016 candidate Marco Rubio said in a speech in Washington after news of Boehner's resignation broke.
In a strict political sense, Boehner's leadership of House Republicans was largely successful. Originally tapped as the House GOP leader in 2007, when Republicans were still in the minority, he was a key figure in shaping the post-George W. Bush Republican Party.
Boehner was an architect of the Republican strategy to oppose Obama at every turn, convincing all House Republicans to oppose Obama's stimulus and health care bills.
“It’s not about him or anybody else, and I’m not here to bash anyone, but the time has come to turn the page, the time has come to turn the page and allow a new generation of leadership."'
And he presided over an expanding GOP majority. There were 202 Republican House members when Boehner took over in 2007. After last year's mid-term elections, Republicans now control 247 of the chamber's 435 seats.
But many of those Republicans were elected in the Tea Party wave of 2010, coming to Washington determined to roll back not just President Obama's agenda, but some of the policies of George W. Bush as well.
By that measure, Boehner was a failure. Obama blocked most of the Republican attempts to curtail his agenda. And on many issues, Boehner didn't really agree with the conservatives in his party in the first place.
Boehner is a conservative Republican but at times took a practical, establishment-minded approach to legislation that was counter to what the party activists and the most conservative members of the GOP wanted. In 2011, Boehner tried to reach a deficit reduction agreement with Obama, only to have it rejected by conservatives, who were worried that the compromise would increase taxes.
After Obama won reelection in 2012, Boehner said the Republicans needed to move on from fighting Obamacare and consider supporting legislation that would legalize the millions of undocumented immigrants who live in the U.S.
House Republicans rejected those ideas. Instead, they forced Boehner to hold numerous votes to repeal Obamacare but never allowed one on the comprehensive immigration bill that had passed in the Senate. Conservatives in the House essentially forced a government shutdown in 2013, despite Boehner's concerns about the idea.
This week, conservatives, particularly the so-called House Freedom Caucus, made up of members aligned with the Tea Party, wanted Boehner to force another shutdown if Obama didn't agree to strip all federal funding from Planned Parenthood on a bill to fund the government.
This strategy, like in 2013, was very unlikely to work. Obama has repeatedly said he will veto any spending bull that defunds Planned Parenthood. But the conservatives insistence on a confrontation, against Boehner's advice, illustrated they were never going to follow his counsel. So he gave up.
In some ways, Boehner's predicament is part of the larger struggle of the Republican Party between its more establishment wing and its conservatives. Boehner has praised ex-Florida Gov. Jeb Bush's vision for the GOP, and some of his former top aides are now working on Bush's campaign. Bush has similarly struggled in a Republican primary dominated by the more conservative posture of Donald Trump.
Several of the Republican presidential candidates, such as Cruz, have said Congress should shut down the government unless Planned Parenthood is defunded. Those candidates taking that view likely did not help Boehner on Capitol Hill.
Some of these problems though are specific to Boehner. Other establishment figures in the Republican Party have been able to hold onto power. Mitt Romney won the GOP nomination in 2012, Kentucky Sen. Mitch McConnell became the Senate Majority Leader earlier this year, Rubio or Bush could become the GOP presidential nominee in 2016.
The conservative insurgents, despite forcing out Boehner, may not even gain control of House. One of the leading contenders to become House Speaker is Boehner's No. 2, Rep. Kevin McCarthy of California, who is an establishment conservative like Boehner. Even if a more conservative figure, like Texas Republican Jeb Hensarling, were to become Speaker, that person would have to reach compromises with Obama.
Boehner is in some ways the first and only victim of the failure of the Republican Party to achieve its policy goals in the Obama era. Party activists and some House members have chosen to pin the blame primarily on Boehner for the GOP's inability to stop Obama, who over the last year has cemented a legacy of pushing America left on a number of issues.
This is no doubt unfair to Boehner. Chief Justice John Roberts, a Republican Supreme Court appointee, twice opted against striking down Obamacare. Another Republican justice, Anthony Kennedy, cast the deciding vote making gay marriage a constitutional right. American voters reelected Obama, a liberal president who is very unlikely to defund Planned Parenthood and reached a nuclear agreement with Iran.
But conservatives can't fire Kennedy, Obama or Roberts. So they chucked aside Boehner instead.
"The resignation of @johnboehner is a victory for the crazies," said U.S. Rep. Peter King of New York, a Republican moderate, in a Twitter message.
This article first appeared on NBCNews.com.