“We could have seen you in about two months, and I know a lot of you are off to all sorts of camps and they’re all checking you out,” Mr. Trump told the team during the visit.

Virginia was facing pressure from beyond its locker room. More than 15,000 people signed a petition, organized by a Virginia graduate, urging the team “to skip the White House visit in protest of Trump and his support of white supremacy.”

Charlottesville has become a byword for white nationalism since the summer of 2017, when neo-Nazis and white nationalists marched through town in protest of plans to remove Confederate statues. One of the protesters, who had expressed support for Nazi policies and violence against African-Americans, rammed his car through a crowd of counterprotesters, killing 32-year-old Heather Heyer. Afterward, Mr. Trump defended the marchers, saying some of them were “very fine people.”

That comment resurfaced this past week when Joseph R. Biden Jr., the former vice president, invoked Charlottesville in announcing his presidential candidacy. Mr. Trump responded Friday by defending his remark.

In an interview on Saturday, Michael Signer, who was Charlottesville’s mayor at the time of the rally, said that until Mr. Trump’s comments on Friday, he thought the team should make its own choice about visiting the White House.

“A lot changed — everything changed — over the last day,” said Mr. Signer, a lecturer at the university.

Mr. Signer added that he expected that Virginia’s fans would support the team’s choice not to go.

“I trust Coach Bennett’s instincts entirely, both on the court and off,” he said. “And I think many Charlottesvillians will see this as a wise and judicious decision.”