President Obama spoke to Boston and the nation Thursday about resilience and perseverance, but his words could easily apply to his own emotional state amid perhaps the most difficult week of his second term.

A president often accused early in his Administration of failing to feel the nation’s pain has drawn deeply on emotion this week to describe a broad defeat on gun-control legislation and to help heal a city after the bomb attack on the Boston Marathon.

Those setbacks -- for the nation’s sense of security and for his second-term agenda --have revealed a different Obama. Clinical when it came to policy decisions and approach in his first term, often to the disappointment of his more ideological base, Obama has used his heart as much as his head this week in response to political and national adversity.

“We may be momentarily knocked off our feet,” Obama told those gathered Thursday in Boston, citing the example of 78-year-old Bill Iffrig, the runner blown down from the blast as he approached the finish line. “But we’ll pick ourselves up. We’ll keep going. We’ll finish the race.”

As he took his place in the front-row pew of the Cathedral of the Holy Cross, Obama wiped tears from his eyes amid swelling applause. The moment recalled the last time he had wept publicly -- that mid-December day when a gunman opened fire inside Sandy Hook Elementary School in Newtown, Conn., killing 20 children and six educators.

Obama pledged then to seek tighter restrictions on gun sales, and for a president who has often located himself in his policy arguments, he made the Newtown families the face of his legislative effort. It is the technique of the community organizer he once was.

But Obama’s national campaign for gun control was knocked off its feet Wednesday when the U.S. Senate, controlled by his own party, defeated the core of his legislative plans including the publicly popular proposal to expand background checks.

In the aftermath, Obama, using a word loaded with moral outrage, said from the Rose Garden, “All in all, this was a pretty shameful day in Washington. “I’ve heard some folks say that having the families of victims lobby for this legislation was somehow misplaced,” Obama said, surrounded by Newtown parents and the wounded former Rep. Gabby Giffords. (D-Ariz.) “ ‘A prop,’ somebody called them. ‘Emotional blackmail,’ some outlet said. Are they serious?”

This was an Obama unrecognizable from the first term , when he spoke about bending “cost curves” in pushing for universal health care and contract law when the executives of AIG, beneficiaries of a government bailout, were receiving bonuses.

But the angry analysis, while stirring to supporters, could not hide Obama’s failure to rally enough Republican and Democratic support on behalf of measures that he noted were popular with huge majorities of the country.

Of his legislative priorities, gun control was not one whose public support was validated by the last election, a surprisingly resounding victory that he invoked often to argue in favor of his tax and spending priorities and for action on immigration.

Newtown happened after election day, and Obama made gun control a priority in his second inaugural address, his State of the Union speech, and visits to a series of cities that have suffered gun violence in recent months.

That was not enough, as he realized this week. A president’s moral outrage bumped up against the lobbying clout of the National Rifle Association and a challenging midterm election map for some Democratic senators - and lost.

“It was a massive reach really,” said Stephen Hess, a presidential scholar at he Brookings Institution. “He simply didn’t have the firepower at the showdown at the O.K. Corral."

It has taken years in the past for presidents, including Bill Clinton, to secure gun-control measures and Hess said the political dynamic in Washington has largely remained the same since then.

Obama and his advisers said repeatedly securing what they had proposed would not be easy, but as bipartisan compromise emerged over the background check measure, there was more fear of the Republican-controlled House of Representatives than of a Senate that appeared ready to act. “The NRA really had the blue state-red state division of the Congress and the 2014 election calendar,” Hess said. “I think it’s fair to chalk it up as an honorable, decent fight that told us a lot about the man who had never shown this sort of emotional response before. Now you move on.”

Obama moved onto Boston, where the first large-scale bombing on U.S. soil in the post- Sept. 11, 2001 era was carried out on a holiday afternoon earlier this week. He invoked his history in celebrating Boston’s, noting his time in the city during law school at Harvard and as the host city for the 2004 Democratic National Convention where he delivered the keynote address that launched his national political career.

Those remarks were built around the notion of ending the partisanship that gripped Washington, and that four years later he pledged in his successful presidential campaign to help end. His remarks Thursday were far different. “This is personal,” Obama told those filling the pews before him. “This is personal.”

But Obama, as he did months earlier in Newtown, also used the victims to tell the story of tragedy and redemption for families, a city, and the country. From the cathedral pulpit, he quoted Scripture repeatedly, urging those gathered to “run with endurance the race that is before us.”

“That’s what you’ve reminded us -- to push on,” Obama said to the city. “We finish the race.”

He has told the Newtown families -- and the country -- he intends to do so with gun control as immigration legislation takes shape and negotiations over the federal budget begin . How he intends to -- whether through emotion or the 2014 midterm elections -- remains to be seen.

More on this story: