US House Speaker John Boehner (R-Ohio). REUTERS/Jonathan Ernst House Speaker John Boehner (R-Ohio) will resign as speaker and from Congress at the end of October, an aide told Business Insider.

The aide told Business Insider that Boehner had planned to retire last year. His calculus was changed, however, by the unexpected Republican primary loss of former House Majority Leader Eric Cantor, a close Boehner ally whose 2014 defeat shocked Washington.

Boehner announced the decision in a House Republican caucus meeting Friday morning, in which Republicans discussed a strategy going forward with a possible government shutdown looming at the end of the month.

The full statement from a Boehner aide:

Speaker Boehner believes that the first job of any Speaker is to protect this institution and, as we saw yesterday with the Holy Father, it is the one thing that unites and inspires us all.

The Speaker's plan was to serve only through the end of last year. Leader Cantor's loss in his primary changed that calculation.

The Speaker believes putting members through prolonged leadership turmoil would do irreparable damage to the institution.

He is proud of what this majority has accomplished, and his Speakership, but for the good of the Republican Conference and the institution, he will resign the Speakership and his seat in Congress, effective October 30.

Boehner's most likely replacement is House Majority Leader Kevin McCarthy (R-California).

Boehner with US President Barack Obama at a luncheon for bipartisan Congressional leaders in the Old Family Dining Room at the White House on November 7. Larry Downing/Reuters

Boehner's speakership has been marked by constant tension with the conservative wing of the House Republican caucus. That pressure has intensified lately — Rep. Mark Meadows (R-North Carolina) in July filed a motion to force the speaker to vacate his post.

More recently, conservatives have pressured Republican leaders in a battle to keep the government from shutting down.

Since the release of 10 undercover videos, Republicans have accused the Planned Parenthood organization of harvesting and selling fetal body parts. Planned Parenthood has mounted a vehement public defense, insisting it has done nothing wrong and accusing its opponents of exaggerating claims in a years-long effort to derail the organization.

Now many Republicans — including a handful of presidential contenders — are pushing to cut off federal funding for the organization. Democrats and President Barack Obama defend the organization, contending that it provides an array of health services for women and that federal money for Planned Parenthood doesn't fund abortion.

Funding for the organization is being tied to the legislative vehicle that will keep the government from shutting down at the end of the month. Therein lies the debate within the Republican Party — its leaders desperately want to avoid a shutdown, given the damage to the party's brand from a 17-day shutdown two years ago.

A good chunk of the Republican Party's rank and file still wants to defund the organization at all costs — even if it means a shutdown. Force President Barack Obama's hand, they argue, and make him veto the legislation that would simultaneously defund Planned Parenthood and prevent a government shutdown.

So far, Republican leaders have refused to give in to conservative ultimatums to tie Planned Parenthood funding to the government-funding bill. On Thursday, Senate Democrats blocked a bill that tied the two together. Senate Majority Leader Mitch McConnell (R-Kentucky) plans to hold a vote on a "clean" bill to fund the government next week, which is expected to pass.

That would leave the onus on the House — and Boehner — to avert a shutdown.