President Obama said failure to pass Trade Adjustment Assistance will eliminate benefits for as many as 100,000 American workers. (Reuters)

Cheers rang out Thursday evening when President Obama made a surprise visit to the annual congressional baseball game at National Park. Thousands of Democratic staffers began to chant: “O-ba-ma! O-ba-ma!” More unexpectedly, Republican lawmakers and staffers, who have been locked in battle with the president for more than six years, began a cheer of their own: “TPA, TPA!” they chanted, voicing approval for Obama’s trade promotion agenda.

Obama flashed the GOP side a thumbs up.

Inside the Democratic dugout, according to several senior aides and lawmakers, the president’s usual allies were appalled by the scene: He was waving to Republicans in approval of trade legislation that most of them opposed.

A day later, the Democratic team threw the president a curveball by blocking his high-stakes bid to win fast-track authority to complete a sweeping, multinational Pacific Rim free-trade accord. For Obama, who has staked enormous personal credibility and political capital on the effort, the loss on Friday represented a major setback on a key presidential priority and renewed questions in Washington about his relationship with the House Democratic caucus.

Though the White House and GOP leaders quickly vowed to try again on trade next week, the rebuke from the president’s own party — despite a personal plea from Obama on Capitol Hill just hours before the vote — sent a clear message that their own skepticism on trade trumped their faith in Obama. The blow left his trade agenda on life support.

The White House dismissed the defeat of President Obama's Pacific Rim free trade initiative as "another procedural SNAFU" in Congress. (Reuters)

“Unfortunately, Democrats did not heed his message,” said Rep. Gerald E. Connolly (D-Va.), who supported the trade deal. “Trade is an existential issue for a lot of Democrats. That transcends everything, including loyalty to him. A lot of Democrats were really anguished about that very choice. They were saying: ‘I don’t want to harm him. I don’t want to damage him. But I can’t go home to my district and say that out of loyalty to him, “I sold you all [out].” ’ ”

The outcome was especially frustrating for a president who has spent four years unable to advance major initiatives — including a tax and budget “grand bargain,” stricter gun control and immigration reform — through Congress in the face of relentless Republican opposition.

After the midterm elections, Obama and his advisers gambled that with the GOP in control of both chambers for the next two years, the scrambled politics of trade would offer the president his best chance to score a legacy-building win in the final stretch of his tenure. Assuming that he could persuade more than a sliver of his own party to support him.

He faced significant odds: Democrats have long been skeptical of the effects of trade, which labor unions have blamed for lost jobs and falling wages in traditional, blue-collar manufacturing sectors.

The president launched an
administration-wide lobbying effort that lasted months and, by virtually all accounts, was more exhaustive and personal than any push he has made since the effort to reform health care in his first year. He phoned and met with key Democratic lawmakers, promised to campaign for them against primary challenges and invited them aboard Air Force One for a trip to a European summit. He traveled to Oregon in May to give a trade speech at Nike in the home state of Sen. Ron Wyden (D), who offered crucial support to help win passage of the fast-track legislation in the Senate.

“The president is personally engaged on this,” Wyden said of Obama on Thursday. “He’s all in.”

But his surprise appearance at the congressional baseball game — the presidential motorcade departed the White House after aides had declared he was in for the night — betrayed the confident tone from administration officials on the eve of the House vote.

The House of Representatives has blocked legislation to "fast-track" trade deals through Congress, dealing a big blow to President Obama (Reuters)

During his tenure, Obama has been criticized by both sides of the aisle for ignoring lawmakers, courting them only when absolutely necessary and failing to establish personal connections that could help him politically.

That the president was attending an exhibition game that was not on his public schedule showed the lengths he felt he had to go to try to salvage his trade deal.

By Friday morning, however, the vote remained in doubt — and Obama was leaving the White House on another scheduled trip, this time to Capitol Hill for an emergency meeting with the House Democratic caucus. Once there, he huddled privately with House Minority Leader Nancy Pelosi
(D-Calif.) and her deputies, before addressing the entire membership.

“You could always say there coulda, shoulda been more with any president,” Connolly said, when asked if Obama’s lack of attention to lawmakers over the years harmed his chances on trade. “This president’s style is different than Bill Clinton’s. He is who he is. I don’t know if somehow it’s fundamentally flawed. It’s just different.”

Most in Congress agree on one thing: The administration, despite its blitz in recent weeks, was facing an opposition, made up of labor unions, environmentalists and progressive Democrats, that has been relentless in lobbying against trade. Led by Rep. Rosa L. DeLauro (D-Conn.), the coalition has met with individual Democrats and with small groups for more than two years to pressure them to oppose any fast-track bill.

Asked by reporters after the vote whether Obama’s trade push came too late, White House press secretary Josh Earnest scoffed.

“I find it hard to believe that the president’s attendance at the 2014 congressional baseball game would have, in any way, contributed to the vote count today,” he said. “I think that the president takes much more seriously members of Congress and their concerns than some analysts do.”

But Obama appeared to be blindsided by Pelosi, who said months ago, during a fact-finding mission to Asia with other lawmakers, that she was “trying to get to yes” on the president’s trade deal. In 2009 and 2010, Obama leaned heavily on her, when she was the House speaker, to help wrestle the Affordable Care Act through Congress with Democratic majorities on a party-line vote.

As the trade vote neared, Pelosi refused to tip her hand, although she appeared to be working with Speaker John A. Boehner (R-Ohio) to schedule a package of related trade bills in such a way as to help them pass the House, even if she didn’t support them. On Friday, taking the floor minutes before the vote, Pelosi broke her silence: “I will be voting to slow down fast-track,” she declared. “Today, we have an opportunity to slow down. Whatever the deal is with other countries, we want a better deal for American workers.”

It was a fatal blow for Obama, and supportive Democrats were stunned.

“She screwed this president,” one lawmaker fumed, speaking on the condition of anonymity out of fear of retaliation. “She pandered to the left. She does not ever want to be outflanked by the left, because that’s her base.”

The minority leader had heeded her center of power, while the president was left wondering where his had gone.

Kelsey Snell contributed to this report.