Speaker John A. Boehner, under intense pressure from conservatives in his party, announced on Friday that he would resign one of the most powerful positions in government and give up his House seat at the end of October, as Congress moved to avert a government shutdown.
Mr. Boehner, who was first elected to Congress in 1990, made the announcement in an emotional meeting with his fellow Republicans on Friday morning.
“My first job as speaker is to protect the institution,” Mr. Boehner said at a news conference at the Capitol, adding, “It had become clear to me that this prolonged leadership turmoil would do irreparable harm to the institution.”
Looking poised and sounding rehearsed, Mr. Boehner, who stunned the capital with his news, became emotional as he recalled a moment alone with Pope Francis, who had been his guest the day before at the Capitol and who had asked the speaker to pray for him.
Reflecting on his decision, he said, “This morning, I woke up, said my prayers, as I always do, and thought, ‘This is the day I am going to do this.’ ”
Most recently, he was trying to craft a solution to keep the government open through the rest of the year, but was under pressure from a growing base of conservatives who told him that they would not vote for a bill that did not defund Planned Parenthood.
Mr. Boehner’s announcement lessened the chance of a government shutdown next week, because Republican leaders will push for a short-term funding measure to keep the government operating and the speaker will no longer be deterred by those who threatened his job.
It will be up to a majority of the members of the House now to choose a new leader, and the leading candidate is Representative Kevin McCarthy of California, the majority leader, who is viewed more favorably by the House’s more conservative members. The preferred candidate among many Republicans, Representative Paul Ryan of Wisconsin, has said he does not want the job.
“John Boehner has been a great leader of the Republican Party and the House of Representatives,” Mr. Ryan said Friday in a statement. “This was an act of pure selflessness. John’s decades of service have helped move our country forward, and I deeply value his friendship. We will miss John, and I am confident our conference will elect leaders who are capable of meeting the challenges our nation faces. I wish John and his family well as he begins the next phase of his life.”
Representative Charlie Dent, Republican of Pennsylvania, said: “The next speaker is going to have a very tough job. The fundamental dynamics don’t change.”
Mr. Dent said there had been “a lot of sadness in the room” when Mr. Boehner made his announcement to colleagues, and he blamed the House’s hard-right members, who he said were unwilling to govern. “It’s clear to me that the rejectionist members of our conference clearly had an influence on his decision,” Mr. Dent said. “That’s why I’m not happy about what happened today. We still have important issues to deal with, and this will not be easier for the next guy.”
“The dynamics are this,” he continued. “There are anywhere from two to four dozen members who don’t have an affirmative sense of governance. They can’t get to yes. They just can’t get to yes, and so they undermine the ability of the speaker to lead. And not only do they undermine the ability of the speaker to lead, but they undermine the entire Republican conference and also help to weaken the institution of Congress itself. That’s the reality.
“Now, if we have a new speaker, is there going to be an epiphany? They won’t be happy if it’s Paul Ryan or Kevin McCarthy, who will have to make accommodations with a Democratic president and the Senate constituted the way it is.”
President Obama said Friday that Mr. Boehner’s resignation took him by surprise. He said he called Mr. Boehner moments before holding a news conference with the Chinese president, and he praised the speaker as a “good man” and a “patriot” who cares deeply about the House of Representatives.
“We have obviously had a lot of disagreements, and politically we are at the opposite end of the spectrum,” Mr. Obama said. But, he added, Mr. Boehner “has always conducted himself with civility and courtesy with me.”
And, the president said, Mr. Boehner is “somebody who understands that in government, governance, you don’t always get 100 percent of what you want.”
The president declined to speculate about Mr. Boehner’s replacement, but he warned that the next speaker should not be someone willing to shut the government down if policy demands were not met.
“You don’t invite a potential financial crisis,” Mr. Obama said. “You build roads, pass transportation bills. You do the basic work of governance. There’s no weakness in that. That’s what government is in our democracy.”
Mr. Obama promised to “reach out immediately” to whoever is the next speaker, and he said that he would continue to work with Mr. Boehner during the month before he leaves the House.
“Hopefully he feels like getting as much stuff done as he possibly can,” Mr. Obama said.
Representative Nancy Pelosi, Democrat of California and the previous speaker of the House, learned about Mr. Boehner’s resignation when she read a breaking news alert on a staff member’s phone. “God knows what’s next over there,” she told staff members. “Coming from earthquake country, this is a big one.”
Ms. Pelosi, who had been negotiating privately on a plan to keep the government open, told reporters that Mr. Boehner’s resignation was “a stark indication of the disarray of House Republicans.”
The announcement came just a day after Pope Francis visited the Capitol, fulfilling a 20-year dream for Mr. Boehner, the son of a tavern owner from a large Catholic family, of having a pontiff address Congress. He had a private audience with Francis before the pope spoke to a joint meeting of Congress.
Mr. Boehner wept openly as the pope addressed an audience gathered on the West Lawn of the Capitol on Thursday. He no doubt understood that it was his last grand ceremony as speaker and, indeed, a capstone to his long political career, which began in the Ohio Statehouse.
“I am happy that one of his final memories will be watching the pope address an institution the speaker loved and served for many years,” Representative Trey Gowdy, Republican of South Carolina, said. “He had an incredibly hard job, as whoever takes his place will learn.”
At the Family Research Council’s Values Voter Summit, which was taking place just a few blocks from the Capitol, many jumped to their feet and cheered when Senator Marco Rubio, Republican of Florida, announced that Mr. Boehner was resigning.
“It’s time to turn the page,” Mr. Rubio said, deviating from his prepared text in an assertion tailored to the audience, whose views align with many who wanted to oust Mr. Boehner.
One of those fed-up Republicans is Joe Glover, a retired businessman from the Dallas area who was at the conference and could barely restrain his jubilation.
“I think it’s awesome,” Mr. Glover said. “No. 1, he needed to go, and No. 2, it should give us an opportunity to have a fresh voice and fresh leadership, because we haven’t seen the leadership from that office we need to see.”
Addressing reporters after his remarks at the conservative summit meeting, Senator Ted Cruz of Texas spoke harshly of Mr. Boehner.
“The early reports are discouraging,” Mr. Cruz said. “If it is correct that the speaker, before he resigns, has cut a deal with Nancy Pelosi to fund the Obama administration for the rest of this year, to fund Obamacare, to fund executive amnesty, to fund Planned Parenthood, to fund implementation of this Iran deal, and then presumably to land a cushy K Street job after joining with the Democrats to implement all of President Obama’s priorities, that is not the behavior one would expect from a Republican speaker of the House.”
Mr. Cruz declined to offer his view of Mr. McCarthy, saying only that he hoped House Republicans “select a strong conservative.”
Mr. Obama said he expected Republicans to debate who would be their next leader, but he was sanguine about the decision bringing significant change, saying, “It’s not as if there’s been a multitude of areas” where Republicans in the House have worked with him in the past.
“There were members in his caucus who saw compromise of any sort as weakness or betrayal,” Mr. Obama said of Mr. Boehner. “When you have divided government, when you have a democracy, compromise is necessary.
He urged the next speaker to work to avoid another shutdown. He said a shutdown would not just “hurt the economy in the abstract, it hurts particular families. And, as I recall, it wasn’t that good for the reputation of the Republican Party.”
Still, Mr. Obama said he expected “significant fights” on issues like the funding of Planned Parenthood and the overhaul of immigration.
While some conservatives were celebrating, one prominent Republican was upset at the news.
Senator John McCain of Arizona said that he was taken aback and that Mr. Boehner’s resignation had perilous implications for Republican prospects going into next year’s elections.
“It means that it’s in disarray,” Mr. McCain said in a brief interview. “Basically, he has been unseated. And that’s not good for the Republican Party.”
His advice? “We’ve got to unite and recognize who the adversary is.”
For decades, Mr. Boehner legislated as a stalwart Republican institutionalist. He became speaker after a Tea Party wave in the 2010 election swept Republicans into the majority in the House on a call to drastically curb federal spending and the role of government.
It was an agenda Mr. Boehner supported, but he quickly found himself hamstrung by the new members of Congress, who were undaunted by the fact that Democrats controlled much of Washington and that their ability to fulfill their goals would have its limits.
That conflict resulted in a 16-day government shutdown in October 2013, the brink of default on the nation’s debt and the undoing of former Representative Eric Cantor of Virginia, who was the House majority leader. Mr. Cantor oversaw the movement of the right to empower Republicans, but he was ultimately defeated in a primary in 2014 by an unknown challenger whose candidacy was fueled by Tea Party energy.
A similar dynamic is shaping the Republican presidential primary process, with both Donald J. Trump and Mr. Cruz openly critical of congressional leaders.
On Friday, even as Republican members of Congress reeled from the news, the architects of the right-leaning movement cheered.
“Americans deserve a Congress that fights for opportunity for all and favoritism to none,” said Michael A. Needham, the chief executive of Heritage Action, a policy arm of the conservative Heritage Foundation. “Too often, Speaker Boehner has stood in the way. Today’s announcement is a sign that the voice of the American people is breaking through in Washington. Now is the time for a principled, conservative leader to emerge. Heritage Action will continue fighting for conservative policy solutions, and we look forward to working with the new leadership team.”
Most recently, Mr. Boehner, a warrior in the anti-abortion movement for 30 years, was under pressure to try to cripple Planned Parenthood as part of a deal to keep the government open.