SCRANTON, Pa. — Joe Biden offered a rare apology on Tuesday night, saying he was sorry for using the phrase “partisan lynching” two decades ago to describe an impeachment proceeding. It came several hours after Biden had called President Trump “despicable” and “abhorrent” for saying the impeachment proceedings against him were a “lynching.”

It is rare for Biden to offer a complete apology; his usually fall into the “I really regret some have taken totally out of context” category, as occurred in 2007 when he called then-candidate Barack Obama, whom he would later serve as vice president, “articulate and bright and clean.”

Tuesday’s apology marked how potentially significant his campaign viewed his use of the word, and also highlighted how Biden’s long history in public life has not always been an advantage. Biden was attempting to limit the damage to what has been the bulwark of his support — black voters — even as he struck out Wednesday to attempt to highlight his ­middle-class roots and an economic policy designed to win back voters in the industrial ­Midwest.

Unlike his Democratic primary rivals, Biden has often had to clean up his past comments before taking a shot at Trump. Others have found their routes simpler, not having to take into account words from decades ago.

The latest example occurred after Trump on Tuesday morning said that the impeachment inquiry amounted to a “lynching.” Biden and many other Democrats and Republicans denounced his use of the word and said it was intended to deepen racial wounds.

“Impeachment is not ‘lynching,’ it is part of our Constitution,” Biden tweeted in response. “Our country has a dark, shameful history with lynching, and to even think about making this comparison is abhorrent. It’s despicable.”

Symone Sanders, his top black staffer and surrogate, wrote on Twitter, “Do not ever describe anything other than actual lynching, as a lynching.” 

But on Tuesday night, CNN unearthed a video of Biden in October 1998 using a similar phrase while talking about the impeachment of President Bill Clinton.

“Even if the president should be impeached, history is going to question whether or not this was just a partisan lynching or whether or not it was something that in fact met the standard, the very high bar, that was set by the founders as to what constituted an impeachable offense,” Biden said in an interview with Wolf Blitzer.

After several hours of criticism, Biden responded. 

“This wasn’t the right word to use and I’m sorry about that,” Biden tweeted Tuesday night. 

Biden quickly transitioned into a criticism of Trump, attempting to argue that he didn’t mean to use the word divisively, whereas Trump did. 

“Trump on the other hand chose his words deliberately today in his use of the word lynching and continues to stoke racial divides in this country daily,” he wrote.

Biden, whose standing in the race has been supported by a huge advantage among black voters, was not alone, however.

The Post identified at least five other Democratic lawmakers — current and former congressmen Danny K. Davis (Ill.), Gregory W. Meeks (N.Y.), Jim McDermott (Wash.), Charles B. Rangel (N.Y.) and Jerrold Nadler (N.Y.) — who talked about a “lynching” or “lynch mob” when it came to Clinton’s impeachment.

The apology came amid new polling that indicated Biden may be gaining ground, following relentless attacks from Trump over the work Biden’s son Hunter did in Ukraine at the same time Joe Biden took the lead on Ukraine policy when vice president.

In a national CNN survey, Biden had the support of 34 percent of Democrats and Democratic-leaning voters, marking his highest level in a CNN poll since just after his campaign began in late April.

The attacks from Trump have threatened to overshadow any effort to change the subject, but on Wednesday Biden attempted to turn toward an economic message by speaking before a friendly crowd two miles from the northeast Pennsylvania home where he grew up.

Although the speech was billed as centering on economic policy, Biden did not release any new ideas and instead reiterated his previous stances that are more incremental than the ones promoted by others in the field.

Biden wants to repeal Trump-era tax cuts, make community college free for everyone and reduce the student debt burden of graduates who go into public service jobs.

But mostly Biden painted himself as someone who can help the middle class — because, he said, his roots lie there. He reflected on buying penny candy and battling a stuttering problem — and declared himself “not a big funny-paper guy,” referring to the comics printed in a newspaper — but also talked about being infused with middle-class values on the streets outside the Scranton Cultural Center.

“Everything my sister Valerie and I learned came from Scranton,” he told the crowd. “Dignity is a word that is probably used in Scranton more than anywhere else. It’s all about dignity. No matter what your station in life, no matter what your background is, you’re entitled to be treated with dignity.”

During hard times, Biden’s father, who shares his name, commuted to Wilmington, Del., to clean boilers for a heating and cooling company — and moved the family there in 1953. In his biography and on the campaign trail, Biden recounts that he and his siblings moved in with their grandparents during hard times.

The economic policy also differentiates Biden from his chief competitors — Sen. Elizabeth Warren (D-Mass.) and Sen. Bernie Sanders (I-Vt.) — whose plans represent the leftward movement of the Democratic Party.

Warren has said repeatedly that America’s economic system has been rigged by “billionaires and big corporations” and has made the de-concentration of wealth a central tenet of her economic policy. Sanders has said in interviews that he doesn’t believe billionaires should exist.

Both have proposed wealth taxes that would raise money from the richest Americans and use it to fund a wide array of other programs.

In Scranton, Biden sought to draw a contrast not just with the other Democrats, but also with Trump.

“More than the memories, what I remember most as I got older, is the values,” he said. “The point of all this as I look back on it is this is where I learned about loyalty. This is where I learned about patriotism. This is where I learned about family. And faith.”

He said many American parents understand what it means to make “that long walk up a short flight of stairs” to tell a child their life was going to change because of economic hardship.

“I don’t think Donald Trump is capable of understanding that,” Biden said later. “He doesn’t have any sense of empathy at all.”