Washington - Mr Barack Obama came to office vowing to bring "change" to America, and after years stymied by partisan battles, a momentous week has left him emboldened and with a stronger claim to have fulfilled that promise.
Last Friday, Mr Obama sat in the residence of the White House, preparing a eulogy for another victim of another mass shooting in the United States. For six years he had used successive tragedies to cajole and coerce Congress into tightening gun laws but failed. Now he would be paying homage to Mr Clementa Pinckney, a slain South Carolina preacher he had known since 2007.
In the immediate aftermath of the Charleston shooting, Mr Obama seemed almost resigned to the limitations of his quickly fading presidency. America would get to grips with the problem "at some point", he said. It was a far cry from his first-term invocations of the "fierce urgency of now".
America's first black president is fond of repeating another dictum borrowed from Martin Luther King Jr, that "the arc of the moral universe is long, but it bends towards justice". The phrase is woven into a rug that encircles Mr Obama's desk in the Oval Office. The murder of nine African Americans, including Mr Pinckney - by a suspected racist 21-year-old white man from the deep south - showed just how long that arc can be.
As Mr Obama wrote, the phone rang. His senior adviser and long-time friend from Chicago, Ms Valerie Jarrett, informed him that the US Supreme Court had made gay marriage legal across the country. It was a decision that crowned a momentous week in American history and in Mr Obama's presidency. In just a few short days, he had won a major trade battle with Congress and the Supreme Court had upheld housing rights and swept aside the last major threat to his signature domestic policy achievement - expanding health care to millions more Americans. "Obamacare" was here to stay and now gay marriage had been enshrined in law - something unthinkable just a few short years ago.
"Progress," he said shortly after in the White House Rose Garden surrounded by euphoric West Wing staff, "often comes in small increments, sometimes two steps forward, one step back.
"And then sometimes, there are days like this when that slow, steady effort is rewarded with justice that arrives like a thunderbolt."
Years defined by biting Fox News criticism, the ultra-conservative Tea Party and congressional gridlock suddenly seemed to have been swept aside.
"I think that on many issues, the President is on the right side of history," Democratic congressman Seth Moulton told AFP. "Sometimes it takes a long time for that to become apparent to everybody... But certainly this is a historic week, and we're witnessing the result of some long battles."
Mr Obama's victories in the past week also seem to reveal a determination to ensure the autumn of his presidency is at least as consequential as the spring and summer. With no more elections, he has appeared increasingly unencumbered and forceful in his calls for change. Historians may see the eulogy for Mr Pinckney as an apogee.
Despite Mr Obama's own personal journey, he has perhaps found it most difficult to bend the arc of history towards equality for black Americans. His tenure has seen repeated shootings of black men by police, persistently high levels of black incarceration and vast income disparities between whites and blacks. "It is striking," said Princeton University's history and public affairs professor Julian Zelizer, that Mr Obama has won "health rights and gay rights with less progress on race". "I do think the progress on race has been slower in recent years than the President hoped would be the case."
But in a country that often seems to still be untangling issues that divided north and south during the Civil War, Mr Obama pulled no punches. The Confederate flag - the Civil War standard of the white slave-owning south that was taken up by alleged South Carolina gunman Dylann Roof - was not just an emblem of heritage, he said. "The flag has always represented more than just ancestral pride," Mr Obama said, in combative language that would have befitted Civil War belligerents Abraham Lincoln or Ulysses S. Grant.
"For many, black and white, that flag was a reminder of systemic oppression and racist subjugation. We see that now." Removing the flag from public buildings, he said, would not be an act of political correctness or an "insult to the valour of Confederate soldiers". "It would simply be an acknowledgment that the cause for which they fought, the cause of slavery, was wrong."
"It would be one step in an honest accounting of American history," he added.
With about 18 months left in office, Mr Obama seems increasingly intent to bend the arc yet further.