House Speaker John A. Boehner (R-Ohio) sacrificed his job on Friday — a wrenching decision that he determined was the only way to spare the country the trauma of yet another government shutdown.

“More than anything, my first job as speaker is to protect the institution,” Boehner said at a news conference, after making the stunning announcement that he will resign from the House on Oct. 30.

While the shutdown crisis may be averted for now, the forces of dysfunction that drove Boehner to quit remain and will likely bedevil the next speaker in similar ways.

Boehner’s decision came at a poignant moment. He announced it the day after an emotional high point for the famously sentimental Boehner, in which the onetime altar boy from Reading, Ohio, hosted Pope Francis for an unprecedented address to a joint meeting of Congress.

The speaker’s resignation — the timing of which he said he decided only Friday morning, after prayer, coffee and his regular breakfast at Pete’s Diner on Capitol Hill — clears the way for passage of a stopgap spending bill to fund the government.

House Speaker John A. Boehner (R-Ohio) resigned Friday and said he feels like he is doing the right thing for the right reasons. (Reuters)

That legislation does not contain line-in-the-sand language that would defund Planned Parenthood, which has become a high-profile cause on the right, but the measure only goes through mid-December.

A group of anti-Boehner insurgents had threatened that if the speaker capitulated to Democrats on the Planned Parenthood funding, they would move to topple him by forcing a vote to vacate the speaker’s chair in the House. Boehner will move a funding package that includes the Planned Parenthood funding, which is expected to be approved next week. But his announced resignation denies the rebels their best leverage for retribution.

In the meantime, the House Republican majority must pick a new leadership team, with Majority Leader Kevin McCarthy (R-Calif.) considered the most likely replacement.

The No. 2 GOP leader, whom Boehner endorsed, has been in Congress less than 10 years. While he has widespread support in the Republican conference, many believe McCarthy lacks the political and tactical gravitas to exert control over what has become an essentially ungovernable House. And there is no reason to believe that McCarthy or whoever the next speaker is will be able to end or contain the intense civil war inside the House Republican Conference.

Boehner’s leadership became a flash point in that battle, with a new generation of GOP lawmakers saying he has been too quick to capitulate to President Obama and the Democrats in Congress.

There had been threats from more than 30 House Republicans that they would force a no-confidence vote against Boehner, which meant the speaker might have ended up in the position of relying upon Democrats to maintain his increasingly tenuous hold on the speaker’s gavel.

As John Boehner resigns from Congress, one of his most memorable traits will perhaps be his frequent tears. Here's a look back at some of the occasions Boehner found himself full of emotion. (The Washington Post)

“I don’t want my members to go through this, and I certainly don’t want the institution to go through this,” he said.

Many of the same newcomers who restored the GOP to its majority in the House and made Boehner its speaker have been the most contemptuous of his management style, which they say represents the established order that they came to Washington to destroy.

Many count Boehner’s resignation as a victory.

Obama “has run circles around this Congress since John Boehner’s been speaker. . . . I think it’s a victory for the American people,” said Rep. Tim Huelskamp (R-Kan.), one of those elected in the momentous 2010 midterm elections that put the Republicans back in control of the House after four years under the Democrats.

In his speech the day before Boehner’s announcement, the pope decried the partisan and ideological warfare that now often defines and paralyzes the American political system.

“The contemporary world, with its open wounds which affect so many of our brothers and sisters, demands that we confront every form of polarization which would divide it into these two camps,” Francis said. “We know that in the attempt to be freed of the enemy without, we can be tempted to feed the enemy within.”

Yet, if anything, that polarization appears to be accelerating with the approach of the 2016 presidential election and a GOP primary season in which the most strident candidate, real estate mogul Donald Trump, is in the lead.

While some of the presidential contenders praised Boehner, most welcomed his decision.

Trump, speaking at the conservative Value Voters Summit in Washington, called Boehner’s resignation “a good thing, and I think someone else will have a little bit tougher attitude.”

“Do people even like him on a personal basis?” Trump asked the crowd. “I don’t understand. They get elected. They’re full of vinegar. They’re going to change things — they’re going to repeal Obamacare. Then they get to these vaulted ceilings, and they change.”

Also at the Value Voters Summit was Sen. Ted Cruz (R-Tex.): “I have long called on Republican leadership to do something unusual, which is lead,” said Cruz, who was a central instigator of the 2013 government shutdown. “Yesterday John Boehner was speaker of the House. Y’all come to town, and somehow that changes,” Cruz added in his speech to the conservative gathering. “My only request is: Can you come more often?”

‘Today’s the day’

Even those who had been working to unseat Boehner, however, were taken aback at the sudden announcement, which he made to his senior staff members at a meeting Friday morning and then to the full GOP House membership.

He said he had to tell McCarthy five times before the second-ranking member of the House GOP leadership would believe him.

At the news conference, Boehner said he had been considering stepping down at the end of last year but that those plans had been derailed by the surprise defeat of then-Majority Leader Eric Cantor (R-Va.) in a Republican primary. More recently, he had thought that he might make his retirement announcement on Nov. 17 of this year, which will be his 66th birthday.

But after hearing the pope’s address, “last night, I started to think about this. And this morning, I woke up and I said my prayers, as I always do, and I decided, you know, today’s the day I’m going to do this,” Boehner said. “As simple as that.”

He added that the first person he told was his wife, Deborah, whose reaction was one word: “Good.”

The arc of Boehner’s 25-year career in the House traces a particularly turbulent period for the institution. The job of speaker used to be one of great job security, but Boehner is the sixth in a row to leave it amid political reversals or scandal.

What makes Boehner different, however, is the fact that the pressures that led to his ouster came strictly from within his party, rather than being engineered by the opposing one.

There is also irony that when Boehner had first come to Congress, after modest beginnings as the son of bar owner, it was as a self-styled disrupter himself.

He was part of a rowdy group of GOP freshmen called the “Gang of Seven,” known for regularly denouncing the entrenched Democratic leadership as corrupt. Their efforts helped pave the way for the landslide 1994 midterm elections that put Republicans in charge of the House for the first time in four decades.

“When I came into Congress, John Boehner was about as tough as nails, as tough as anybody I’ve ever met,” said another member of that group, former senator Rick Santorum (R-Pa.), who is now running for president. “He never backed down from a fight. We took on the establishment.“

Santorum added: “I think he made a wise decision to move on and give someone else a chance.”

Boehner’s fortunes in the House have been a series of ups and downs. He was brought into the leadership fold early, only to be expelled in a rank-and-file rebellion, and then begin a long and steady rise back into leadership.

That culminated with the historic 63-seat gain in 2010 that propelled Republicans into the majority and handed Boehner the speaker’s gavel.

Almost immediately, however, several dozen new Republicans who had aligned with the tea party movement began clashing with Boehner and opposing his efforts at compromise, which the party’s more establishment wing considered an essential lubricant of governing.

Leadership shuffle

Boehner’s resignation is likely to cause a cascade of changes down the chain of Republican leadership.

Republican conference Chairwoman Cathy McMorris Rodgers (Wash.), Majority Whip Steve Scalise (La.) and Budget Committee Chairman Tom Price (Ga.) are widely considered to be top contenders to become the next majority leader.

Others considering a bid for a top leadership spot are Chief Deputy Whip Peter J. Roskam (Ill.), Financial Services Chairman Jeb Hensarling (Tex.) and Rules Committee Chairman Pete Sessions (Tex.).

While those internal party races are likely to be bruising, only the speaker’s seat is subject to an actual House vote.

With Boehner’s resignation, there will be 246 Republicans voting for the next speaker, and all but a few Democrats will vote to support Minority Leader Nancy Pelosi (D-Calif.). A majority vote of 218 is necessary to elect a speaker, so Republicans cannot afford to have more than a couple of dozen dissenters.

As for Boehner, he demurred on how his leadership will be remembered.

“I was never in the legacy business,” he said at his news conference. “I’m a regular guy with a big job. And I never thought I’d be in Congress, much less I’d ever be speaker.”

“But people know me as being fair, being honest, being straightforward and trying to do the right thing every day on behalf of the country,” Boehner added. “I don’t need any more than that.”

Paul Kane, Robert Costa, Dave Weigel, Jose DelReal, Juliet Eilperin and Ed O’Keefe contributed to this report.