WASHINGTON—President Biden laid out why he decided to “pass the torch” to Vice President Kamala Harris and what he hopes to accomplish in his final months in office as he addressed the nation from the Oval Office Wednesday evening, his first formal remarks since his dramatic announcement Sunday that he would end his re-election campaign.


“The defense of democracy, which is at stake, is more important than any title,” Biden said, casting his decision to leave the race as self-sacrifice to protect the country.

Biden added: “I have decided the best way forward is to pass the torch to a new generation. That is the best way to unite our nation.”

Biden spoke for just over 10 minutes, reading his address from a teleprompter. The president, who just recovered from a Covid-19 infection, didn’t cough as he spoke but his voice remained hoarse.

It is part of a wider effort by Biden’s team to burnish his accomplishments while in office and ensure that his contributions don’t get lost, as the party moves on to Harris, who has already locked up enough support to be the Democratic nominee. The Oval Office address kicks off that effort. Biden, 81, imperiled his candidacy when he performed badly during a 90-minute debate in June. The president and his team initially dismissed the dismal debate as “one bad night.” But he flubbed subsequent public appearances, cementing a view among Democrats that he would be unable to effectively prosecute a case against former President Donald Trump .

Biden referenced his age during his remarks. “There’s also a time and a place for new voices. Fresh voices. Yes, younger voices,” Biden said. “And that time and place is now.”

He only referred to the 59-year-old Harris once. “She’s experienced, she’s tough, she’s capable,” he said. Harris is the expected nominee for the Democratic presidential contest now that he has bowed out.

As he spoke, Biden was joined in the Oval Office by members of his family including his wife Jill Biden, their daughter Ashley Biden and his son Hunter Biden along with several of his grandchildren. His longtime adviser Mike Donilon also was there along with other members of his staff. They broke out into applause when the president finished speaking.

The president said that he was grateful for his roughly 50 years in public service and praised the American system of government that allowed him to rise to the pinnacle of power. “Nowhere else on earth could a kid with a stutter, from modest beginnings in Scranton, Pennsylvania and Claymont, Delaware, one day sit behind the Resolute Desk in the Oval Office as president of the United States,” Biden said. “But here I am.”

He also praised the government that he has been a part of for all that time. “The great thing about America is here, kings and dictators do not rule. The people do. History is in your hands. The power is in your hands. The idea of America—lies in your hands.”

Trump, the Republican nominee for president, reacted to the speech by posting on social media. “Crooked Joe Biden’s Oval Office speech was barely understandable, and sooo bad!” Trump wrote. Biden slightly flubbed a few words, but the speech didn’t include the kind of glaring miscues that raised alarms during his debate and some subsequent interviews.

Other Republicans are pushing for the president to leave office immediately. “If Joe Biden is not fit to run for President, he is not fit to serve as President,” said House Speaker Mike Johnson (R., La.) in a statement. “He must resign the office immediately. November 5 cannot arrive soon enough.”

White House press secretary Karine Jean-Pierre said that any suggestion of Biden leaving office before his term ends was “ridiculous.” She also disputed that the White House purposefully hid any decline in Biden’s health. “There’s been no coverup,” Jean-Pierre said.

Biden gave some flavor of where he plans to focus over the remaining six months of his presidency, saying he still hopes to make progress on the Cancer Moonshot, his effort to cure the disease that killed his son Beau and impacts millions of Americans. He also said that he’ll keep “calling out hate and extremism.”

He said there’s still work he can do on stemming climate change and preventing gun violence. And he plans to push for ethics reforms to the Supreme Court.

On foreign policy, Biden said he would continue to focus on a peace deal in the Middle East, rally the coalition of countries trying to stop the Russian invasion of Ukraine and work to secure the release of Americans unjustly held abroad. Wall Street Journal reporter Evan Gershkovich is among those being wrongly held, though Biden didn’t mention him by name.

It is only the fourth time that Biden has addressed the nation from the Oval Office, a venue that presidents typically use for only the most important messages. He spoke from there a little over a week ago after the assassination attempt on Trump .

Members of Biden’s senior staff stayed at the White House Wednesday evening to be there as Biden gave the address.

Biden’s weekend exit marked the third time that he has departed from a presidential race. In 1987, he bowed out of the 1988 campaign amid a plagiarism scandal. He also left the 2008 presidential race after finishing poorly in the Iowa caucuses.

But Biden’s defeat that year didn’t shadow him for long: He was tapped to be Barack Obama ’s vice presidential candidate months later.

Write to Annie Linskey at annie.linskey@wsj.com