WASHINGTON (AP) -- Plunging Congress into deeper turmoil, House Speaker John Boehner abruptly announced his resignation Friday, shutting down a tea party drive to depose the nation's highest-ranking Republican but opening up fresh troubles for the GOP.
The 13-term Ohio lawmaker, second in line to the presidency, shocked his rank-and-file when he told them of his plans in an emotional closed-door meeting. He said he would step down from the speaker's job he's held for nearly five years, and from Congress, at the end of October.
One important result: A government shutdown threatened for next week is all but sure to be averted - but only for now. A new December deadline and a potentially market-rattling fight over the government's borrowing limit still lie ahead.
Boehner's announcement came one day after a high point of his congressional career, a historic speech by Pope Francis to Congress at the speaker's request.
It also came before what would have been a new low: a potential floor vote to oust him as speaker, pushed by Republican tea partyers convinced he was capitulating in a struggle over Planned Parenthood funding that threatened a government shutdown next Thursday. Such a formal challenge against a speaker has not been used in the House for over 100 years.
On Friday, an upbeat Boehner declared that he'd decided to spare the House, and himself, the chaos such a vote would bring.
"It's become clear to me that this prolonged leadership turmoil would do irreparable harm to the institution," he said.
"I don't want my members to have to go through this. I certainly don't want the institution to go through this," he said. Of his resignation, he said, "Frankly, I am entirely comfortable doing it" - and he broke into a brief refrain of "Zip-a-Dee-Doo-Dah" to demonstrate his point.
Even as he announced his plans to leave, Boehner told lawmakers they could expect to vote next week on legislation to fund the government through Dec. 11 with Planned Parenthood funding intact, a bill likely to pass with Democratic help, notwithstanding conservative complaints.
So no shutdown for now. But Boehner will leave behind a stack of other problems, including the new December funding deadline, a crucial highway bill, and the annual battle over the federal borrowing limit.
And it's not clear that the next speaker will have any easier time taming the unruly tea party lawmakers who forced Boehner out despite the largest GOP majority in 84 years, or making the deals with the White House and Senate Republicans that Boehner habitually cut to keep the gears of government running.
Although a disorderly leadership race is certain for some of the top jobs, the likeliest contender to replace Boehner is his current No. 2, Majority Leader Kevin McCarthy of California, whom Boehner endorsed on Friday, saying he "would make an excellent speaker."
After Boehner's announcement, President Barack Obama praised him as "a good man" and a patriot.
"Maybe most importantly, he's somebody who understands that in government and governance, you don't get 100 percent of what you want," the president said. "We can have significant differences on issues but that doesn't mean you shut down the government."
With his relaxed and sociable demeanor, love of golf and well-known tendency to cry in public, Boehner was popular among House Republicans. But though he is also known as a strong conservative, his tactics were never confrontational enough to satisfy the most conservative faction.
He said he had planned all along to announce in November that he was resigning at the end of this year, but had not said so publicly. After emotional moments Thursday at the pope's side, he woke up Friday morning and decided now was the time.
A number of conservative lawmakers cheered the news. "We need bold leadership, and this gives us a chance to get it," said Rep. Louie Gohmert of Texas.
Outside tea party groups also declared victory, underscoring a schism between conservative base voters and establishment leaders that has made Boehner and Senate Majority Leader Mitch McConnell nearly as scorned in some quarters of the GOP as Obama himself.
At a meeting of the Values Voters Summit in Washington where religious conservatives were gathered to hear from GOP presidential candidates, attendees and some candidates alike erupted in extended applause and cheers at the news Boehner was stepping aside.
"You want to know how much each of you terrify Washington?" Texas Sen. Ted Cruz asked the crowd. "Yesterday, John Boehner was speaker of the House. Y'all come to town and somehow that changes. My only request is, `Can you come more often?'"
Several conservatives made clear they would now be gunning for McConnell, and presidential candidate Bobby Jindal, the governor of Louisiana, called on the Senate leader to resign.
Boehner is just the latest in a long line of speakers to have been driven from the office. Every speaker since Thomas "Tip" O'Neill retired in 1987 has stepped aside under pressure or lost the job when the House majority flipped.
Boehner, 65, took over the speakership in January 2011. His tenure has been defined by his early struggles to reach budget agreements with Obama and his wrestling with the expectations of tea party conservatives.
Two years ago, conservatives drove him to reluctantly embrace a partial government shutdown in hopes of delaying implementation of Obama's new health care law. The move was unsuccessful. Nonetheless, tea party lawmakers had been pressing him to retry the tactic to try to take away federal funding from Planned Parenthood following the disclosure of controversial videos involving its practices of procuring fetal tissue for research purposes.
Surprised Democrats saw disorder in the House GOP, with Minority Leader Nancy Pelosi calling Boehner's resignation "seismic."
Boehner was first elected to the House in 1990 and soon established a strongly conservative record, becoming part of Speaker Newt Gingrich's leadership team when Republicans took control in 1995 for the first time in four decades. He was ousted from his leadership role after the GOP's disappointing performance in the 1998 midterms but eventually climbed back to the top.
On Friday aides circulated a list of accomplishments including banning earmarks, enacting money-saving reforms to Medicare this year, and leading education reforms.
Associated Press writers Alan Fram, Mary Clare Jalonick, Deb Riechmann, Stephen Ohlemacher, Steve Peoples and Andrew Taylor contributed.