WASHINGTON (Reuters) - U.S. House of Representatives Speaker John Boehner will leave Congress at the end of October after struggling with repeated rebellions by conservatives during a tumultuous five-year reign as the chamber’s top Republican.

The 65-year-old Ohio lawmaker stunned Republican House members at a meeting on Friday morning with the announcement that he would leave the top job in the 435-seat chamber and resign his seat effective on Oct. 30.

U.S. Representative Kevin McCarthy, 50, of California, the No. 2 House Republican, quickly became the leading contender to replace Boehner as speaker. While loyal to Boehner, McCarthy has built personal relationships with conservative groups and tacked right recently to back the shutdown of the Export-Import bank.

Boehner (pronounced BAY-ner) told reporters McCarthy “would make an excellent speaker.”

Boehner has faced constant pressure from conservatives who believe he was too willing to compromise with President Barack Obama and too frequently relied on Democratic votes to pass crucial legislation.

Obama praised the speaker as “a good man” and said he hoped Boehner would be in a position to get a lot done before he leaves.

Boehner told reporters he was stepping aside to avoid another brewing House battle over his leadership. Conservatives had threatened a revolt and possible government shutdown over spending next week.

“It’s become clear to me this prolonged leadership turmoil would do irreparable harm to the institution,” Boehner told a news conference. He fought back tears as he thanked his family but happily sang “Zip-A-Dee-Doo-Dah” to indicate he was far from broken up about the decision.

“It’s the right time to do it, and frankly I’m entirely comfortable doing it,” Boehner said.

His move eased the threat of a federal government shutdown next week, Republicans said, freeing Boehner to forge ahead with a “clean” spending bill that funds the women’s healthcare group Planned Parenthood without fear of reprisal from conservatives who object to the group’s abortion services.

But the battle over Boehner’s successor could coincide with fights later this year over government spending and raising the federal debt limit, complicating those battles and adding more uncertainty for financial markets.

House Democratic leader Nancy Pelosi, a longtime foe of Boehner and his predecessor as speaker, said his pending departure would be “a distraction” during the spending debate and called his decision “seismic to the House.”

On Thursday, Boehner, a Roman Catholic, realized a longtime goal of hosting Pope Francis for an address to Congress. As he stood with the pope to greet crowds on the Capitol’s West front, he broke down in tears.

‘TODAY’S THE DAY’

Boehner said he had planned to step down as speaker at the end of 2014 but changed his calculation when his No. 2 at the time, Eric Cantor, lost his seat last year in a Republican primary.

He then planned to announce in November that he would leave at the end of this year, he said, but came to the conclusion after his morning prayers on Friday that “today’s the day I’m going to do this. Simple as that.”

He informed staff just before the morning meeting with Republican House members.

Slideshow ( 6 images )

“I saw him recently and he looked weary. Understandably, he was tired,” U.S. Senator John McCain of Arizona, also a Republican, told reporters. “Sometimes we fail to appreciate that these are human beings with human emotions and lives to lead.”

An NBC News/Wall Street Journal opinion poll on Friday found 72 percent of Republican primary voters were dissatisfied with Boehner and Senate Republican Leader Mitch McConnell.

Raucous cheers broke out at a gathering of religious conservatives in Washington when Senator Marco Rubio of Florida, a candidate for the 2016 Republican presidential nomination, announced that Boehner planned to step down.

“I’m not here to bash anyone,” Rubio told the crowd. “But the time has come to turn the page.”

Slideshow ( 6 images )

Despite their clashes, Boehner frequently had bowed to the House’s conservative wing, standing by as conservatives forced a government shutdown in 2013 and abandoning comprehensive immigration reform in 2013 and 2014.

Many Republican lawmakers predicted McCarthy would be the next speaker. The five-term lawmaker has built bridges to Tea Party conservatives and bucked Boehner by abandoning support for renewing the charter of the U.S. Export-Import Bank.

Conservatives successfully killed renewal of the bank’s charter, arguing government should not meddle by picking economic winners and losers. Ex-Im offers financing to foreign buyers of U.S. goods.

McCarthy ignored reporters’ questions about his future plans as he exited the morning meeting.

“Now is the time for our (House Republican) conference to focus on healing and unifying to face the challenges ahead and always do what is best for the American people,” he said in a statement.

There was no immediate market reaction.

Phil Orlando, chief equity market strategist at Federated Investors, said: “The near-term news is good in that it suggests that Boehner is going to get a clean bill through as his last act as speaker, but the question becomes what happens post-Halloween and who the new speaker is going to be.”

The son of a bar owner and one of 12 children, Boehner is the only college graduate in his family. He grew up in Cincinnati and served in the U.S. Navy in 1969, then became a small businessman before launching a political career.

On Thursday evening as Boehner left the Capitol, he told two reporters - one from Politico and another from the Washington Post - that he had nothing left to accomplish after bringing Pope Francis to the Capitol, Politico reported.