When Barack Obama was elected president of the US, he vowed 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.
On Friday morning Obama sat in the residence of the White House, preparing a eulogy for another victim of another mass shooting in America.
For six years Obama had used successive tragedies to cajole and coerce Congress into tightening gun laws, for six years he had failed.
Now he would be paying homage to Clementa Pinckney, a slain South Carolina preacher he had known since 2007.
In the immediate aftermath of the Charleston shooting, Obama seemed almost resigned to 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 Obama's desk in the Oval Office.
The murder of nine African Americans including Pinckney -- by a suspected racist 21-year-old white man from the deep south -- showed just how long that arc can be.
As Obama wrote, the phone rang.
His senior advisor and long-time friend from Chicago, Valerie Jarrett, informed him that US Supreme Court had made gay marriage legal across the United States.
It was a decision that crowned a momentous week in American history and in Obama's presidency.
In just a few short days, Obama 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."
Obama's victories in the last seven days 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 to run, he has appeared increasingly unencumbered and forceful in his calls for change.
Historians may see Pinckney's eulogy as an apogee.
Despite Obama's own personal journey, he has perhaps found it most difficult to bend the arc of history toward 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 white and black.
"It is striking," said Julian Zelizer, history and public affairs professor at Princeton University, 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, 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," 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 valor 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."
With around 18 months left in office, Obama seems increasingly intent to bend the arc yet further.