WASHINGTON >> President Barack Obama firmly defended his decision to cut nearly three decades off convicted leaker Chelsea Manning’s prison term Wednesday, arguing in his final White House news conference that the former Army intelligence analyst had served a “tough prison sentence” already.

Taking questions on many topics two days before his presidency ends, Obama also warned that the “moment may be passing” for a two-state solution to the Israeli-Palestinian conflict, pushing back on criticism over his recent move to put pressure on the Jewish state over settlement-building. Turning his attention to President-elect Donald Trump, Obama said he reserves the right to speak out as ex-president if Trump violates America’s “core values.”

Obama said he granted clemency to Manning because she had gone to trial, taken responsibility for her crime and received a sentence that was harsher than other leakers had received. He emphasized that he had merely commuted her sentence, not granted a pardon, which would have symbolically forgiven her for the crime.

“I feel very comfortable that justice has been served,” Obama said.

Manning was convicted in 2013 of violating the Espionage Act and other crimes for leaking more than 700,000 classified documents while working as an intelligence analyst in Baghdad. Formerly known as Bradley Manning, she declared as transgender after being sentenced to 35 years in prison. She had served more than six years before Obama commuted her sentence on Tuesday, with a release date set for May.

“The notion that the average person who was thinking about disclosing vital, classified information would think that it goes unpunished, I don’t think would get that impression from the sentence that Chelsea Manning has served,” Obama said.

Obama’s defense of controversial decisions came as he prepares to exit the presidency after eight years marked by major victories on health care, the economy and climate change, along with disappointments over his inability to achieve his goals on immigration, gun control and closing the Guantanamo Bay prison. He also wound down wars in Iraq and Afghanistan, but wrestled with other security threats posed by the Islamic State group and the Syria civil war he was unable to resolve.

Even many of Obama’s proudest achievements, like the “Obamacare” health care overhaul, stand to be rolled back or undermined by President-elect Donald Trump, a shadow that hangs over Obama’s legacy as he leaves office. The formal end comes Friday when Obama and Trump will motorcade together to the Capitol for Trump’s swearing-in before Obama, then an ex-president, flies with his family to California for a vacation.

Reflecting on his legacy as the first black president, Obama disputed the notion that race relations had worsened. And he dismissed as “fake news” the idea that there is widespread voter fraud in the U.S., a notion that Democrats say is used to justify restrictions that make it harder for African-Americans to vote.

Appearing one last time in front of the White House seal, Obama said he was “significantly worried” that the growth of Jewish settlements in Palestinian territories would “increasingly make a two-state solution impossible.” He stood behind his decision to allow a U.N. Security Council resolution to pass criticizing Israel over the settlements, though he conceded Trump might pursue a different approach.

“If you do not have two states, then in some form or fashion you are extending an occupation,” Obama said.

He defended his administration’s rapprochement with Cuba and his eleventh-hour move to end the “wet foot, dry foot” policy that lets any Cuban who makes it to U.S. soil stay and become a legal resident. Ending the visa-free path was the latest development in a warming of relations that has included the easing of the U.S. economic embargo and the restoration of commercial flights between the U.S. and the small island nation.

“That was a carry-over of an old way of thinking that didn’t make sense in this day and age, particularly as we’re opening up travel between the two countries,” Obama said of the “wet foot, dry foot” policy.

After leaving office, Obama plans to write a book, raise money to develop his presidential library, and work on a Democratic initiative to prepare for the 2020 round of congressional redistricting. Yet he said he plans to assume a low profile in the months after he leaves office, and to avoid commenting on politics on a daily basis.

“I want to be quiet a little bit, and not hear myself talk so darn much,” Obama said.

Yet he carved out room for potential exceptions. Obama was insistent that he wouldn’t stay silent of Trump tried to deport children brought to the U.S. illegally, a group Obama has sought to protect though executive action.

“That would merit me speaking out,” Obama said.

Although Obama had long intended to take one last round of questions before leaving office, White House officials said that in recent days, Obama became intent on using the occasion to draw a symbolic contrast with Trump on issues of accountability and press freedoms. Trump’s team has said it’s considering changes to the traditional daily press briefing and to the location of news conferences, stoking concerns among journalists that their ability to cover the presidency may be scaled back.

Obama alluded to those concerns in his opening remarks, noting the role the press plays in American democracy.

“It doesn’t work if we don’t have a well-informed citizenry, and you are the conduit,” Obama said.