WASHINGTON (AP) -- Long past the prime of his presidency, Barack Obama is defying the lame-duck label and solidifying the contours of his legacy with the help of unlikely allies in Congress and the Supreme Court.
Led by Chief Justice John Roberts, the high court preserved Obama's signature health care law Thursday, hours before a Republican-controlled Congress paved the way for an Asia-Pacific trade pact at the center of the president's international agenda. The Supreme Court also handed Obama a surprise win by upholding a key tool used to fight housing discrimination.
"This was a good day for America," Obama said, speaking from the White House Rose Garden shortly after the court rulings.
For a president deep into his second term, the legal and legislative victories were a vindication of policy priorities that have sapped his political capital and exposed rifts with his own Democratic Party. The back-to-back successes also energized a weary White House, with senior officials and longtime advisers making little effort to hide their glee.
"I don't think that a lot of people expected that a lame-duck president could still very actively lead on every major issue being debated today," said Bill Burton, a former White House and campaign adviser to Obama.
The coming days could bring further clarity to president's legacy, as U.S. negotiators work feverishly to finalize a nuclear deal with Iran ahead of a June 30 deadline. While securing an elusive agreement would mark a major foreign policy breakthrough for Obama, it could be months or even years before it's known if a deal successfully prevents Iran from building a bomb.
Against the backdrop of his recent successes, Obama will also confront the stark limitations of his presidency when he travels to Charleston, South Carolina, Friday to deliver a eulogy for victims of last week's massacre at a black church. Obama has failed to make any progress on gun control legislation, and even against the backdrop of the tragedy in South Carolina, he made clear he had given up hope of pursuing such measures again during his remaining 19 months in office.
Despite the unfinished business Obama will leave behind, Thursday's health care ruling largely answered what has long been one of the biggest questions looming over his White House: Would the sweeping health care overhaul that has fueled so much Republican hostility toward Obama survive his presidency?
Now, that answer is all but guaranteed to be yes.
The Supreme Court ruling marked the second time the justices have saved the health care law, with Roberts writing the majority opinion both times. In an ironic twist, Obama as a senator voted against Roberts when he was nominated by former Republican President George W. Bush.
While House Republicans may still hold votes to repeal the health care measure, as they have already done more than 50 times, the Senate and Obama's veto power prevent such efforts from going any further. And even if Obama is succeeded by a Republican president, fully repealing the law could become less politically palatable given the millions of Americans who have gained health care coverage through its mandates.
"The 6-3 decision is strong validation of the constitutionality of the law," White House senior adviser Valerie Jarrett said of the court's ruling. "Coupled with over 16 million people who currently have health care who didn't have it before, that makes it very difficult to unwind."
Still, some Republican presidential candidates insisted that remained their goal.
"This decision is not the end of the fight against Obamacare," said Jeb Bush, the former Florida governor. "I will work with Congress to repeal and replace this flawed law with conservative reforms that empower consumers with more choices and control over their health care decisions."
Obama had to flip Washington's standard political scorecard in order to get support for the Asia-Pacific trade pact. While Republicans are largely supportive of free trade, many of Obama's fellow Democrats fear such agreements put American workers at a disadvantage and have weak environmental protections.
Just two weeks ago, Democrats dealt Obama an embarrassing defeat on trade, leaving him searching for a solution with many of the same Republicans lawmakers who decry the health care law.
The unusual coalition succeeded. On Wednesday, Obama secured the authority to get fast approval for a final Trans-Pacific Partnership deal, and on Thursday, Congress sent a workers' assistance package to his desk.
White House officials cast Obama's successful dealings with Republicans as evidence of what they had hoped would be another piece of the president's legacy: an ability to work with his political opponents and curb Washington's intense partisanship.
But few in the White House or elsewhere in the nation's capital expect this brief detente between Obama and the GOP to last for long, especially as they stare down deadlines this fall on taxes and spending - issues that have rivaled health care in driving deep divisions between the Democratic White House and Republican lawmakers.
"It's going to give the White House some momentum going into the fall," said Jim Manley, a former adviser to Senate Minority Leader Harry Reid, D-Nev. "But I don't think anyone can expect the efforts to work with Republicans on trade to translate into help on these tax and spending issues."
ALSO ON HUFFPOST:
How will Donald Trump’s first 100 days impact YOU? Subscribe, choose the community that you most identify with or want to learn more about and we’ll send you the news that matters most once a week throughout Trump’s first 100 days in office. Learn more