At a rally in Orlando, Oct. 28, President Obama contrasted Republican presidential candidate Donald Trump with the opponents he faced in his two general election fights. (The Washington Post)

President Obama’s motorcade was still hurtling through Las Vegas traffic when the Rev. Anthony Harris took the microphone to deliver the opening prayer at a rally here for Hillary Clinton.

He looked out on the crowd of 3,000 in the high school gymnasium, waiting for the president to arrive. The feeling was different now than it had been eight years earlier, when Obama had just been elected and Harris led his congregation in prayer for the president. Then, there had been crying and cheering in his tiny storefront chapel and a sense that anything was possible.

Now, Harris, 47, took a deep breath. He hoped his words would rise above the anger and divisiveness of an election season unlike any in his lifetime.

“We pray that at the end of this political process we can learn to love each other, bless each other and trust each other,” he told the crowd, but that noble sentiment did not survive the rally’s first speaker.

Taking the microphone, Sen. Harry M. Reid (D-Nev.) blasted Republican presidential nominee Donald Trump as a “liar,” a “racist” and a “fraud.”

Obama was a symbol for healing America’s racial wounds. His legacy will reflect a more complicated story.

“Lock him up! Lock him up!” the pro-Clinton crowd in the gym started to chant, echoing the anti-Clinton chants of “Lock her up!” that have become common at Trump rallies

“I know people are frustrated,” Harris recalled, thinking as he returned to his seat. “But what does ‘lock him up’ even mean?”

In the week leading up to Election Day, the president will crisscross the country in an effort to help Clinton win the White House and safeguard his legacy. If those events are anything like last week’s campaign stop in Las Vegas, Obama will be met by rowdy, cheering throngs eager to see him one last time before he leaves office.

For many, who will wait hours in line to hear him speak, Obama’s 2008 election represented one of the most hopeful moments in American politics in decades. He was not only the first African American president but a relative newcomer to national politics with a remarkable life story who promised to bridge the country’s historic divides.

“If there is anyone out there who still doubts that America is a place where all things are possible, who still wonders if the dream of our founders is alive in our time, who still questions the power of our democracy, tonight is your answer,” Obama said that election night in Chicago’s Grant Park.

Today those words sound as if they came from a different era. Obama will close out his presidency at what is perhaps the least hopeful moment in American politics in decades, a time when the two major-party candidates have historically low approval ratings and are locked in a bitter and coarse election contest. For much of this year, Obama, like the people who pack his rallies, has puzzled over what happened.

“It’s one of the few regrets of my presidency that the rancor and suspicion between the parties has gotten worse instead of better,” he said at his State of the Union address in January.

Obama’s tone grew darker this past summer, following the killing of two black men by police in Minnesota and Louisiana, and the slaying of five Dallas police officers. “It’s hard not to think sometimes that the center won’t hold and that things might get worse,” he confessed.

In other speeches — many of them drowned out by the angry rhetoric from the campaign trail — Obama has sought to describe the qualities he believes are needed to make American democracy work. He called for more empathy and an “open heart” in Dallas. At a Howard University commencement address, he emphasized compromise and tolerance. In Springfield, Ill., where his political career began, Obama made the case for campaign finance reform and an end to gerrymandering.

“We’ve got to build a better politics,” he said, “one that’s less of a spectacle and more of a battle of ideas.”

In Las Vegas, Obama tried another tack, blaming Republicans and the “far-right media” for the state of political disarray. “They said I wasn’t born here. They said climate change is a hoax,” Obama told the crowd. “They said I was going to take everybody’s guns away . . . and impose martial law. . . . So people have been hearing it and they start thinking, well, maybe this is true. . . . Is it any wonder that they end up nominating someone like Donald Trump?”

Corey Friedl, a 66-year-old retiree clad in an Obama 2008 T-shirt, shared the president’s sense of disappointment and outrage.

Eight years ago, when Obama promised the crowd in Grant Park that a “defining moment of change” had come to America, tears were streaming down Friedl’s face. “His words were more than inspirational,” she said. “They were a reality that I never thought I would live to see.”

The years since have been tough for her family and many of her friends. The billions of dollars spent bailing out Wall Street were not enough to save the small community bank where she worked as an executive assistant. “All the money went to the big guys,” she said. Only recently had she noticed the tourism economy in Las Vegas bouncing back.

She had hoped that the election of the first black president would ease racial tensions. Instead, she said, it seemed as if Obama’s presidency had “brought out the racism that’s in the country.”

Her 45 minutes in the crowded gymnasium cheering for Obama offered a respite from the otherwise nasty election season. Obama, his shirt sleeves rolled up and his mood buoyant, hit the high points of his presidency: 15 million new jobs, incomes finally rising again, Osama bin Laden dead.

“We have made so much progress, despite the forces of opposition and discrimination, and the politics of backlash,” Obama said as he finished his speech and rushed back to his limousine.

Friedl, her legs sore from waiting in line for tickets, leaned on a cane as she walked out of the gymnasium. “I am in love with him,” she said of the president. “He’s just so inspirational.”

Outside the high school gymnasium, the skies had darkened and a stiff desert wind sent campaign fliers, paper cups and plastic garbage cans hurtling across the parking lot.

Rosie Dowd, one of the school janitors, scrambled to pick up the trash. She had been busy working during the president’s remarks and had caught only fragments of his speech. But she said she remembered Election Day 2008 as if it had just happened.

“I was home in front of the television with my children — planted,” she said. “I just screamed, ‘Thank you, God. Thank you, God. That man is heaven-sent.’ ”

Her view of what came next was more sober. “Living through the life I have lived, I know there’s no such thing as pulling off everything,” she said.

Dowd blamed the country’s faltering morals for its increasingly toxic politics. “I see it every day in the schools,” she said. “Parents aren’t doing their jobs at home.”

Friedl blamed Trump. “I call him Voldemort,” she said, comparing him to the villain in the “Harry Potter” books.

On the car ride home after the speech, Friedl and her friends shared pictures from the rally and recounted the president’s best Trump taunts.

This year, Friedl said, she will stay up until all the election returns are in and the next president has delivered a victory speech to the country. But she knows she will feel more relief than joy when it is all done.

“All of my friends and family are so ready for the country to move beyond this election,” she said. “Me, too. I’d rather feel hopeful than hopeless.”