John A. Boehner’s week on the brink ended in a painfully familiar place.

It began last week when President Obama delivered a stern message to the House speaker: If there was going to be a deal to tame the nation’s debt, it had to happen now. If they went over the “fiscal cliff,” it would only become harder to reach a deal, Obama said.

The next day, Friday, Boehner (R-Ohio) phoned Obama offering what seemed like a major breakthrough: Republicans would agree to raise tax rates for the first time in decades if the president gave a key concession on entitlement reform.

That offer set in motion seven days of dealmaking, posturing and cajoling by Boehner and other House leaders, first on a grand deal with the White House and then on a Plan B with their own House caucus. By Thursday night, both deals had fallen apart, and Boehner was near tears in announcing the failure to his colleagues, Republicans said.

The failure of a grand bargain was the latest oh-so-close moment for Obama and Boehner, who have been dancing around a deal to cut the deficit for the better part of the past two years. And the collapse of Plan B set a new low in Boehner’s sometimes rocky relationship with a House Republican caucus that has long been uneasy about the speaker’s dealmaking with Obama.

Following the latest breakdown in negotiations, Democrats said Boehner should return to the bargaining table with Obama — or just let House Democrats and 25 or so Republicans vote for a Senate-approved plan to extend tax cuts for the middle class. But Republicans said the well has been so poisoned that restarting bipartisan talks would be more difficult than ever.

In a statement late Thursday, Boehner said it was now up to Senate Majority Leader Harry M. Reid (D-Nev.) and Obama to come up with an agreement — without explaining what role he would play. The speaker ignored reporters’ questions and, at 8:04 p.m., he walked out of the Capitol.

A week earlier, the possibility of a deal seemed as promising as it ever had.

As he was heading home to Ohio for the weekend, Boehner called Obama with an offer to allow tax rates for incomes above $1 million to rise from 35 percent to 39.6 percent. In exchange, Boehner demanded a key change to entitlement spending that would lead to reduced benefits.

With a potential $1 trillion in spending cuts — out of a total $2 trillion debt deal — Boehner also suggested that the debt ceiling could be lifted a similar amount and give the Treasury another year of borrowing authority.

The next 72 hours would prove critical. Having offered so much, Boehner hoped he could keep the details quiet long enough for him to get Obama to agree to enough spending cuts to satisfy his caucus — and so that his leadership team could make the case for compromise in person.

But the details did not stay secret for long. Reports leaked out Saturday evening that Boehner had agreed to raise taxes on millionaires. That was followed by a more alarming leak Sunday evening that Boehner was also willing to grant Obama another increase in the federal debt limit. Home in their districts, unsuspecting rank-and-file Republicans were stunned.

At that point, senior aides to those lawmakers began anxiously reaching out to GOP leadership staff wanting to know what had happened to the Boehner demand that every dollar in a debt ceiling increase would come with an equal cut in spending.

Boehner’s staff scrambled to issue a memo to Republican aides and outside conservative strategists that explained his offer included $1 trillion in spending cuts — roughly the increase in the debt ceiling. But other leadership aides said that the damage had already been done.

The final blow came Monday, when it became clear that Boehner wasn’t going to get the cuts from Obama that he felt he needed. After a 4 p.m. meeting with his leadership team, Boehner called Obama again.

It was time for Plan B, he said.

Having gambled and lost with Obama, Boehner would now gamble with his own caucus.

“Plan A was going nowhere. They had been talking for weeks, and they couldn’t lock something down. So you gotta go to Plan B,” Rep. Fred Upton (R-Mich.), one of three powerful committee chairmen advising Boehner on the talks, said Thursday.

Plan B was simple: Republicans would vote to permanently extend tax cuts for virtually all taxpayers, while raising rates on millionaires.

The rationale was to take the tax issue off the table by extending tax breaks to more than 99.8 percent of taxpayers, according to senior GOP aides. Removing the tax issue, one outside Boehner adviser said Thursday, would then put Boehner and House Majority Leader Eric Cantor (R-Va.) in a stronger position to argue for deeper spending cuts. “Trench by trench,” the adviser said.

Some Republicans defended Boehner even as they suggested they wouldn’t have supported the framework he was pursuing, saying that the White House could not be trusted.

“There were a lot of gimmicks in the proposals coming from the White House,” said Rep. Tom Reed (R-N.Y.) “Double counting previous counts, [war savings], interest payments. There was a lot of Washington, D.C., maneuvers in there.”

But to many Republicans, Plan B never made much sense. Why would the party of lower taxes vote to raise them?

Exiting their regular Tuesday morning meeting, many Republicans seemed to think that Plan B would lead to higher taxes without gaining anything in return. Freshman Rep. Mike Kelly (R-Pa.), a former Notre Dame football player prone to giving locker-room-style speeches in defense of Boehner, said he was puzzled. “There’s just nothing real clear to me,” he said Tuesday morning.

On Wednesday, Boehner vowed that Plan B would pass. But the natural glad-hander was also more aggressive in pursuing his colleagues on the House floor, where he was trying to rally support for Plan B, according to his aides. The speaker walked up and down the aisles of the Republican half of the chamber, nodding at some members and shaking hands or patting the shoulders of others.

As he made one final pass at wavering colleagues, Boehner went to the front of the chamber and briefly sat behind Reps. Phil Gingrey and Jack Kingston, two conservative Republicans from Georgia strongly opposed to tax hikes. He was seen waving his hands at one point before getting up to go.

On Thursday, it was Cantor who confidently predicted victory.

But behind the scenes, concern was growing when it became clear that Ohio Republicans — the supposed backbone of Boehner’s strength — were considering opposing Plan B. During votes Thursday afternoon, Cantor and House Majority Whip Kevin McCarthy (R-Calif.) were seen speaking with several potential “no” votes, including Rep. James B. Renacci (R-Ohio), who won tough races in 2010 and 2012 with strong support from Boehner.

Sen. Rob Portman (R-Ohio), a former House member and backer of Plan B, returned to his old chamber to try to gain the support of his Buckeye State Republicans. He later said he had been directed by GOP leaders to join the effort.

Several senior GOP aides said that many of the Republicans were wary of voting for Plan B because they worried it would lead to a primary challenge.

By Thursday afternoon, according to a GOP aide familiar with the whip count, it had become clear that the measure was doomed for failure.

Shortly after 7 p.m., GOP leaders abruptly adjourned the chamber and called an emergency meeting in the same Capitol basement room that they had huddled in Tuesday morning. It lasted less than 10 minutes, as leaders announced they did not have the votes and that the House would not return until after Christmas.

Kelly, who finally came around to supporting the plan, was incredulous, according to Republicans in the room. As others headed for the door, Kelly raced to the front of the room and grabbed the microphone.

“Really,” he screamed, according to Republicans. “We can’t support our speaker?”

Rosalind S. Helderman and Felicia Sonmez contributed to this report.