WASHINGTON -- President Donald Trump was ready to celebrate.

On the day House Republicans narrowly passed a bill to overhaul former President Barack Obama's health care law, the famously image-conscious new president wanted to seize the moment. He delayed a trip to his hometown of New York, followed the vote closely on television and quickly bused in his fellow Republicans to the White House after the vote and assembled them in the Rose Garden.

Trump pumped his fist as he arrived to cheers, declaring that his first step in repealing and replacing the "Obamacare" law that he had campaigned against had "brought the Republican Party together. We're going to get this finished."

Rose Garden ceremonies are normally reserved for major bill signings and big presidential moments, but Trump wanted to project an image of success -- even on a bill that passed the Republican-led House with only a vote to spare.

The White House and Republican leaders in the House had slowly cobbled together enough support for the legislation after House Speaker Paul Ryan was forced to pull the bill from consideration in March. But even in the final week, as Trump called on-the-fence members by phone -- he told one lawmaker, "We need you, man!" -- the bill stood on the brink of failure, an outcome that would have badly damaged Trump, Ryan and the party.

A look at the last-minute negotiating and behind-the-scenes pep talks that led to Thursday's passage of the House health care bill.

NO VOTES CHANGE TO YES

"It's not going to get my 'yes' vote the way that it is," Rep. Fred Upton said in an interview on Tuesday morning with WHTC in Holland, Michigan.

Upton's declaration of opposition set off alarm bells. The Michigan lawmaker was the type of influential Republican that the party's leadership needed behind the bill. He had worked as a young staffer in the Reagan administration and once chaired a House committee that oversees health care. But as a moderate, Upton was troubled by changes to the bill aimed at placating conservatives. He emailed House Majority Leader Kevin McCarthy, R-Calif., on Monday to tell him he couldn't support it.

Upton's opposition, along with Rep. Billy Long, R-Mo., a Trump ally, quickly put into motion efforts to amend the bill.

Upton and Long collaborated on an amendment that added $8 billion over five years for state high-risk pools, aimed at helping seriously ill people pay expensive premiums. Briefing Trump at the White House on the amendment on Wednesday, Upton reminded the president that he had said in a CBS interview last weekend that he wanted to ensure that coverage for pre-existing conditions were as strong as Obamacare.

"We can now say that they are, with the adoption of this amendment," Upton said later. Trump's top concern was whether the changes would risk losing votes among conservatives. Once he was assured it wouldn't, he was on board. And Upton and Long were back to "yes."

TRUMP'S SALESMANSHIP

During the final week, Trump called about 20 wary House members, often late at night. A senior administration official said the president repeatedly told lawmakers that passing the health care overhaul was important to "the future of the party" and essential to fulfilling the promises they had made to voters since 2010.

After the setback in March, Trump did not want to dictate when the House would vote on the bill -- he wanted them to vote once they had corralled enough support -- but he knew time was of the essence. The House faced a recess next week and administration officials worried their window of opportunity could be closing.

"'Billy, we really need you, we need you, man,'" Trump told the Missouri congressman earlier in the week, according to Long's description of the conversation. On Wednesday morning, McCarthy walked into his office and was told Trump was on the other line.

"I happened to be the majority leader and the former whip. I know my members well. The president gives me a list of who he thinks would be best to talk to on the list. And he was right," McCarthy said in the Rose Garden, adding that "they all voted for the bill."

PUMPING UP THE CONFERENCE

A Thursday morning meeting for GOP lawmakers had theme music -- and it was not subtle. "Eye of the Tiger," Survivor's theme from the 1982 film "Rocky III," and Bachman-Turner Overdrive's "Takin' Care of Business" played as members streamed in.

When lawmakers settled in, they prayed and said the Pledge of Allegiance.

Ryan shed his typically cool and wonky demeanor for something more like a high school football coach rallying the team before homecoming. "It's time to roll," he told the group, adding, "We live and die by this day."

"He pointed out, 'Look, I'm the guy who had to go tell the president of the United States last time we don't have the votes. I'm the guy who had to sit there and make the argument we shouldn't put it up now because we have an opportunity to come back another day,'" said Rep. Tom Cole, an Oklahoma Republican. Lawmakers applauded and cheered after the Ryan remarks.

--

THE PRIME MINISTER CAN WAIT

Trump was supposed to depart for a New York City meeting with Australian Prime Minister Malcolm Turnbull. But the president was watching the House floor.

As the House prepared to vote, Trump tweeted in rapid succession: "I am watching the Democrats trying to defend the 'you can keep you doctor, you can keep your plan & premiums will go down" Obamacare lie,'" he wrote. Then he noted insurance companies were "fleeing" Obamacare.

Finally, he extended an invitation. He said he would host Republicans at "the beautiful Rose garden" immediately after the vote if they passed the bill.

Just as the vote hit the magic 216 number, signifying passage, House Democrats began singing "Na Na Na Na, Hey, Hey, Hey, Goodbye," waving to their Republican colleagues. They believe the GOP health care plan will prove so unpopular that many of the lawmakers won't be re-elected next year.

The health care bill now moves to the Senate, raising the question: Will Trump get another chance to celebrate?

--

Associated Press writers Julie Bykowicz and Erica Werner contributed to this report.