PORTLAND, Ore. — On the night in 2008 that then-Sen. Barack Obama publicly claimed he had secured the Democratic presidential nomination after a long primary season, there was one blemish — he’d lost the day’s South Dakota primary to Hillary Clinton.

Obama would also lose the state twice in general elections.

The White House says that political history was not a factor that kept Obama from visiting South Dakota during the 2,297 days he’s been president. And managed to visit all 49 other states.

Finally, though, on Friday afternoon, Obama will become the fourth president to have visited all 50 of the United States.

He’ll deliver the commencement address at a community college in Watertown, SD, and for the loyal blue Democratic president and deeply red state, it has become a cause for celebration.

“He saved the best for last,” Sen. John Thune (R-SD) said in an interview with this reporter, and every other reporter who’s been asking about the milestone in the last few weeks.

Gary Young, owner of Young’s Primetime Sports, in Watertown, SD, sports a “Saved the Best for Last” T-shirt he made for the president’s visit.AP

Richard Nixon was the first president to visit all the states, achieving the milestone in just his first three years. (He was also only the fourth president to preside over a nation of 50 states.)

It took Bill Clinton until his final week in office to visit No. 50 — a trip planned only after he learned he was one short.

George H.W. Bush managed to visit all 50 states in his only term, but his son ended his two-term presidency without setting foot in Vermont.

As Obama entered his last two years in office, his itinerary this year conspicuously included other states he’d been absent from during his presidency. After his State of the Union address in January, he went to Idaho to discuss advanced manufacturing.

APJust over a month later, he went to South Carolina for a town hall meeting. And in April he stopped in Utah for remarks on the economy.

The common factor: all states he’d lost twice in general elections. But the White House prefers to argue he’s championing ideas that have bipartisan support, and visiting red states to help illustrate that point.

Obama will continue that theme in Watertown, where he’ll promote his proposal to provide free community college tuition.

Mike Rounds, South Dakota’s other Republican senator and the state’s former governor, noted that the school Obama is visiting, Lake Area Technical Institute, has one of the highest graduation and job-placement rates in the state.

“For the young men and women that are at the technical school, this is an experience of a lifetime for them,” said Rounds, who will attend the ceremony as the uncle of a graduate.