Some Republicans, including Mr. Boehner and Mr. McCarthy, are pressing Representative Paul D. Ryan of Wisconsin, the party’s nominee for vice president in 2012, to step up. Mr. Ryan, however, has repeatedly said he does not want the job, a point he reiterated Thursday even before his colleagues left the meeting.

Image Mr. McCarthy quit the speaker’s race. Credit... Doug Mills/The New York Times

“I have spent more time trying to talk him into running than I did my wife into marrying me,” Representative Trey Gowdy of South Carolina said. “Twenty-six years later, she’s still with me. I am just asking Paul for 14 months.”

Mr. McCarthy’s decision leaves the House rudderless just weeks before the Treasury Department faces a debt default that could roil markets, and two months before a deadline for a budget deal to avoid another government shutdown. But it also represents another victory for the clutch of unyielding hard-line conservatives who toppled the ambitions of yet another member of the party leadership.

The turmoil in the House only added to the uncertainty for the Republican Party, which is also dealing with a contentious presidential primary campaign in which obstreperous outsiders continue to ride the Tea Party swell against establishment politicians. While the presidential race has many months to sort itself out, House Republicans have little time to spare to restore order.

After Mr. McCarthy’s announcement, many visibly shaken and nearly speechless Republicans emerged from a large hearing room in the Capitol complex. The acoustics inside were so poor that some had failed to fully take in what had happened: The man with the most votes to become the next speaker had just given up on what was once the most desired job in the House.