Barack Obama ran for and entered the White House with the promise of becoming a transformational leader — someone who could alter the fundamental direction of the nation's politics in a more progressive way.

But with the defeat of Hillary Clinton and the subsequent loss of what could fairly have been described as a third presidential term, Obama's legacy is imperiled.

How history judges the "Obama Era" now will, in part, depend on Donald Trump and whether he will unwind or leave in place his predecessor’s policies.

Working around a Republican Congress that had long blocked his ideas, Obama spent his final two years in office using his executive power and international agreements in an aggressive attempt to reshape American and international policy.

He helped orchestrate the agreement reached with Iran to limit its nuclear weapons program; Trump has said he will scrap it.

Trump has vowed to repeal and replace large swaths of the Affordable Care Act, Obama’s signature healthcare reform overhaul which left America with its lowest rate of uninsured people in decades.Obama poured political capital into helping craft the Paris agreement that the U.S. reached with more than 100 nations to limit global warming to 2 degrees Celsius.

Absent comprehensive immigration reform, he pushed policies limiting the deportations of undocumented immigrants.

Related: How Trump Could Erase Key Parts of Obama's Legacy

He oversaw an increase in taxes on the rich to levels not seen since the Reagan administration and redistributing much of that money to lower-income Americans.

Under Obama, the Dodd-Frank law was enacted which puts tighter limits on Wall Street banks and created a Consumer Financial Protection Bureau designed to serve as a kind of national watchdog for Americans against businesses.

U.S. President Barack Obama signs the American Recovery and Reinvestment Act Bill next to U.S. Vice President Joseph Biden at the Denver Museum of Nature and Science February 17, 2009. LARRY DOWNING / REUTERS

And he helped push criminal justice and policing reforms that in effect were an attempt to wind down both the “War on Drugs” and aggressive policing tactics that disproportionately affected blacks.

Trump has suggested he will end or radically change all of these policies.

“Based on policy, the record is impressive, if it is not undone,” said Julian Zelizer, a Princeton University professor and historian who recently organized a meeting of scholars who presented papers on their views of Obama’s legacy on politics and policy.

“If much of it stays on the books, I think he will be looked back at as the Democrat who broke through in ways other Democrats had not figured out how to do in a conservative era,” Zelizer added. “But if the result of the election is wholesale retrenchment, the main story will be about how and why his party suffered so much over the last eight years.”

The Road to Economic Recovery

President Obama, still buoyed by the “hope and change” optimism of his first presidential campaign, entered office as the U.S. was mired in what became known as the “Great Recession.”

The unemployment rate, which reached 10 percent in Obama’s first year, is now 4.6 percent. The stimulus bill that Obama signed in 2009, which pumped more than $800 billion into the economy, helped stem that recession, according to many non-partisan experts. The non-partisan Congressional Budget Office has said the stimulus increased America’s GDP, reduced the unemployment rate and helped cause more hiring.

Obama’s decision to put taxpayer money into Chrysler and General Motors helped two of the largest American automakers remain in business, and a recent study suggested that 225,000 jobs have been added at motor vehicle and parts dealers since 2009. (Some studies are even more bullish on the auto rescue, suggesting it saved nearly 2 million jobs.)

Trump was catapulted into office by white working class workers from Rust Belt and coal producing states who felt those policies didn’t go far enough to help them. He has promised bring jobs back to America by scrapping on day one the Trans-Pacific Partnership trade deal.

This is a death blow to the Obama administration's efforts as they spent tremendous political capital on the controversial, multinational trade deal. They hoped the accord would further cement U.S. influence and values in Asia and other parts of the world while improving labor, wage and environmental standards globally, thereby discouraging American outsourcing.

Warriors and Retrenchment

Obama ran for president skeptical of the use of American troops in resolving conflicts abroad, particularly in the Middle East. In office, Obama has brought thousands of troops back home — and not redeployed them.

In 2009, about 34,000 thousand troops were in Afghanistan and another 140,000 were in Iraq. The Obama administration says it plans to have about 9,400 troops in Afghanistan when it leaves office, and there are more than 5,000 American troops in Iraq.

Obama has pushed for the resignations of the leaders of Egypt, Libya and Syria. But he refused to send large numbers of soldiers to those countries-or anywhere else.

At least in the short term, this retrenchment may be enduring.

Trump won the presidency by similarly pledging not to deploy large numbers of U.S. troops abroad.

Obama “tried to determine what’s vital to American interests and what’s not and to prioritize,” said Fredrik Logevall, a professor of history and international relations at Harvard’s Kennedy School.

“I think there is a lot of skepticism—maybe not among people in the establishment—but among ordinary Americans about military intervention. Under Trump, it could be hard to reverse that kind of policy,” Logevall added.

Unfinished Business

On other policy issues, the president’s record is more complicated. U.S. Census Data released this year showed that the median income for American households increased by 5 percent from 2014 to 2015. But this income, $56, 515, is essentially the same as it was in 2007, before the recession. Costs for college and health care in particular continued to grow for most Americans.

Most American troops are out of Afghanistan and Iraq, but Obama, like George W. Bush, was not able to stabilize either country. Obama ordered the raid that successfully killed Osama Bin Laden, but a new terrorist threat emerged in ISIS, which the president at first underestimated.

Then Secretary of State Hillary Rodham Clinton, President Barack Obama and Vice President Joe Biden, along with members of the national security team, receive an update on the mission against Osama bin Laden in the Situation Room of the White House in Washington. Pete Souza / The White House via AP

Obama essentially replaced American troops with drone strikes, angering some liberals who view that policy as both inhumane and an overreach of executive power. It’s not clear if Trump will continue that policy.

Related: How Trump Can Gut Obama's National Security Policies on Day One

On counter-terrorism, “Obama really concentrated the power in the presidency, so that he was the one making the decisions,” said Kathryn Olmsted, a historian at the University of California, Davis, noting that Obama at times personally signed off on drone strikes to kill suspected terrorists.

“Obama decided he wanted to take over this himself. I don’t know if Trump will decide to do that,” added Olmsted, who is working on a paper on Obama’s terrorism policies.

A guard walks into the Guantanamo Bay Detention Center, also known as "Gitmo", a maximum security detention center at the U.S. Naval Station at Guantanamo Bay, Cuba on Oct. 22, 2016. The U.S. military's Joint Task Force Guantanamo is still holding 60 detainees at the prison, down from a previous total of 780, including 20 cleared for release. On his second day in office in 2008 President Obama issued an executive order to close the prison, which has failed because of political opposition in the U.S. Congress, mostly from Republicans who argue that they won't jeopardize national security over a campaign promise. John Moore / Getty Images

And despite Obama's early promises to close the detention facility at Guantanamo Bay, it is unlikely he will do so before leaving office.

Social Change, Diversity...and the Backlash

As the nation’s first black president, Obama often sought to serve as a unifying figure who could in some ways help heal America of its racial, cultural, ideological and partisan divides.

The changes around diversity, culture and inclusion that happened under Obama were monumental: a black president; a black — and very popular — first lady; a female nominee of a major political party; the first Latino Supreme Court justice; the first two black attorneys general; same-sex marriage nationwide; legislation adopted in many liberal areas to protect the rights of transgender Americans; a civil rights movement of protests and activism that resembles that of the 1960’s; a repeal of the “don’t ask, don’t tell” law, making it clear that openly-gay people can serve in the U.S. military.Obama’s role in these shifts varied widely.

The president was the driver of his own ascent and that of his appointees. He put the imprimatur of the U.S. government behind a gay rights movement that was already very strong and pushing him to do more.

He was hesitant about the Black Lives Matter movement at first, but later fully embraced it. The images of Obama and his appointees—including many women and non-whites—leading the country can’t be erased.

White House staff members listen to President Barack Obama speak about Donald Trump's victory in the Rose Garden of the White House. Senior Adviser Valerie Jarrett is at left. White House Communications Director Jen Psaki is at center and to her left is National Security Adviser Susan Rice. JIM LO SCALZO / EPA

Trump has described the same-sex marriage issue as “settled,” even as the new president could in theory seek to appoint Supreme Court justices who would overturn the 2015 ruling that invalidated gay marriage bans.

The renewed push for black and Latino civil rights, has been adopted by the leaders of the Democratic Party and many of its voters, and is likely to be a permanent part of the party’s ideology in the future.

Tolerance and inclusion for people of all religions, races and sexual identities is now one of the defining features of the Democratic Party, which controls most of America’s largest cities and states.

Related: Gay Rights and WorkerRights: The New Battles Between Blue and Red America

But there has been a tremendous backlash to Obama's push for diversity and inclusion — and the effects of that rejection were seen during the 2016 election.

Over the president’s objections, Republicans across the country passed laws limiting early voting and requiring photo ID’s to vote, moves that some federal judges say were explicitly aimed at reducing votes of blacks and Latinos.

In a 17-candidate GOP field, Trump won while running most aggressively against Obama’s vision of inclusion, suggesting he would limit Muslim immigration to the United States and deport undocumented immigrants.

“Left wing movements thrived under Obama,” said Michael Kazin, a history professor at Georgetown University and author of the 2011 book "American Dreamers: How the Left Changed a Nation.” He added “but as Trump's narrow win shows, white workers had no comparable movement and so responded to a man who made them promises that Clinton did not.”

A Party Strong in Cities and On Coasts—And Nowhere Else

Two trends — white voters in the South and Appalachia increasingly backing the GOP while the liberal-leaning Asian and Latino populations grew in size — preceded Obama.

But in Obama’s eight years in Washington, these shifts fully took hold, reshaping American politics.

Hillary Clinton won the popular vote in 2016 by following the model of Obama’s campaigns in 2008, aggressively appealing to Asian, black and Latino voters and college-educated whites who pride themselves on tolerance and inclusiveness. With that coalition, Democrats have won the popular vote and carried previously Republican states Colorado and Virginia in three straight elections.

In 2004, John Kerry won California by about 10 percent. Hillary Clinton won by the state more than 30 percent in 2016.

The Democratic Party of 2016 is more than 40 percent non-white, compared to about 25 percent in 1996, according to the Pew Research Center.

At the same time, Obama could not stop huge swaths of the country from shifting Republican, as white, non-college-educated voters increasingly vote for GOP candidates.

His party, already weak in the South before Obama’s ascent, is now virtually powerless in that region outside of Virginia and North Carolina.

Arkansas had two Democratic senators and a Democratic governor when Obama entered office. All three of those jobs are now held by Republicans.

The Democratic ranks of House members and U.S. senators from the South have been decimated.

Read: United States of Trump

But Republicans won the presidential race in 2016 in part by flipping Iowa, Ohio, Michigan and Wisconsin. All four of those states now have a Republican governor and GOP-controlled state legislatures.

Next year, the GOP will control the governor’s office and the state legislature in 25 states.That is compared to just 10 states totally controlled by the GOP early in the president’s term.

A farmer's barn in Somerset in rural central Ohio features a show of support for presidential candidate Donald Trump. Christine Ruddy / Shutterstock

It’s hard to determine exactly how much Obama accelerated these trends, as opposed to simply being in the Oval Office as they happened.

Obama and his team heavily invested in turning Colorado and Nevada blue and more broadly to increase Latino turnout.

The president’s policy moves, particularly his executive orders to protect undocumented immigrants from deportation, also firmly aligned Latinos with the Democrats and opened the door for Trump to campaign to white, non-college educated voters as the candidate who was wary of increased immigration and wanted to build a wall between the United States and Mexico.

A young protester holds a sign for immigrant rights, during a rally for deportees and Dreamers in Downtown San Diego, CA on Thursday, March 20, 2014. Sandy Huffaker/Corbis / Corbis via Getty Images

At the same time, white, economically-insecure American increasingly drifted from his party, despite Obama policies aimed at them.

About 9 million of the 20 million Americans who are newly-insured because of the Affordable Care Act are white, according to estimates from the federal government.

Kentucky and West Virginia were two of the states where the uninsured rate dropped the sharpest after Obamacare’s implementation. They were also two of the states that most sharply shifted to the GOP from 2012 to 2016.

"Obama’s victories combined with his legislative successes in his first term were galvanizing to the Republican Party,” said Meg Jacobs, a research scholar at Princeton’s Wilson School of Public and International Affairs and author of “Conservatives in Power: the Reagan Years,” adding “Not only in the sense of ‘we’ve lost,’ but that we’ve got to organize politically and ideologically against these policies."