President Joe Biden on Saturday, graduates of a leading historical told Black university that American history “has not always been a fairy tale” and that “racism has long torn us apart.” But on the country’s best days, he said, “enough of us have the courage and the heart to stand up for the best in us.”

As Mr. Biden spoke, more than a dozen caps Howard University students stood with their backs to him and held handmade signs in silent protest against what they said were many forms of white supremacist violence.

In his speech, Mr. Biden described the 2017 white nationalist rally CharlottesvilleVirginia, which he has said helped push him to run for president in 2020.

Hate “never goes away” and “silence is complicity,” Biden said.

“We know that American history has not always been a fairy tale,” Mr. Biden said, describing a constant “push and pull” between the idea that people are created equal at all and “the harsh reality that racism has long torn us apart.”

“But on the best of days, enough of us have the courage and the hearts to stand up for the best in us,” he continued. “Choosing love over hate, unity over division, progress over retreat.”

Mr. Biden, who recently announced he is running for a second term in 2024, said he came to Howard to “continue the work of redeeming the soul of this nation,” which was a theme of his 2020 campaign.

He told the students that they fuel his optimism for the future.

“You are part of the most gifted, tolerant, gifted, best educated generation in American history. That is a fact,” he said. “And it is your generation, more than anyone else’s, that will answer the questions for America : Who are we, what do we stand for, what do we believe in, what do we want to be.”

It was unclear whether Mr. Biden was aware that several students had been turned away as they held handmade signs protesting some of the injustices he mentioned in his speech. One sign names Jordan Neely, the New York City subway artist who died on May 1 after being held in a chokehold by another passenger.

The passenger, Daniel Penny, 24, a former Marine, turned himself in to police Friday to be charged with manslaughter. He was released pending trial.

“We as academics stand united for change, for Black Lives globally,” the students said in a statement.

Mr. Biden spoke after being awarded an honorary Doctor of Letters.

The speech at Howard was the first of two commencement addresses Mr. Biden will give this year. He is scheduled to address students from the US Air Force Academy in Colorado on June 1.