President Trump granted a posthumous pardon Thursday to boxer Jack Johnson, the first black heavyweight champion, who was convicted in 1913 for violating a Jim Crow-era law that made it illegal to transport a white woman across state lines “for the purpose of prostitution or debauchery, or for any other immoral purpose.”

“A truly great fighter,” Trump said in the Oval Office, where he signed the pardon in a ceremony attended by boxing legend Lennox Lewis, actor Sylvester Stallone and current heavyweight champion Deontay Wilder, among others who had advocated for Johnson’s pardon. “He had a tough life.”

Trump noted that a pardon for Johnson, whom he called “one of the greatest that ever lived,” had considerable support in Congress, including within the Congressional Black Caucus. The president said Johnson served prison time “for what many view as a racially motivated injustice.”

Johnson was charged in 1913 for violating the Mann Act, a law that Jim Crow-era prosecutors often used as an anti-miscegenation device, and ended up spending almost a year in prison. His story was the basis of the 1970 movie “The Great White Hope” starring James Earl Jones.

Trump tweeted last month that he would consider pardoning Johnson after receiving a call from Stallone, who, according to the president, had explained the fighter’s “complex and controversial” life.

Congressional leaders had long lobbied presidents to pardon Johnson. “No president ever signed it, surprisingly,” Trump said Thursday.

A bill requesting a pardon from President George W. Bush passed the House of Representatives in 2008 but died in the Senate.

A 1,000-page education bill in 2015 included a provision requesting a pardon for Johnson. It called the boxer a “flamboyant, defiant and controversial figure in the history of the United States who challenged racial biases.”

Sen. John McCain (R-Ariz.) and former senator Harry M. Reid (D-Nev.), along with Reps. Peter T. King (R-N.Y.) and Gregory W. Meeks (D-N.Y.), later requested a pardon for Johnson from President Barack Obama in 2016, but those requests also fell flat.

“We have done something today that was very important and that is, we righted a wrong,” Trump said Thursday.

The move was celebrated by many of boxing’s biggest names — “It’s about time,” wrote George Foreman, the former heavyweight champion — and by legislators who had championed the cause. McCain said in a statement that the pardon “finally closes a shameful chapter in our nation’s history and marks a milestone that the American people can and should be proud of.”

John Arthur “Jack” Johnson, nicknamed the “Galveston Giant” in the ring, was born in 1878 southeast of Houston. By 1903, he became the unofficial “Negro heavyweight champion.” World heavyweight champion Jim Jeffries refused to fight him and instead retired. But in 1910, Johnson gained the championship belt, and Jeffries emerged from retirement to “reclaim the heavyweight championship for the white race.”

“Jeff, it’s up to you,” novelist Jack London wrote before the bout, according to NPR. “The White Man must be rescued.”

Johnson pummeled Jeffries for 15 rounds in “the battle of the century” and won the belt outright.

“I could never have whipped Johnson at my best,” Jeffries said later. “I couldn’t have hit him. No, I couldn’t have reached him in 1,000 years.”

The Mann Act was signed just weeks prior, though, and federal investigators almost immediately began looking into Johnson’s romantic life.

He married a white woman, Etta Terry Duryea, in 1911, but she committed suicide a year later. Three months after, he married Lucille Cameron, who was also white. Her mother was so disgusted with the relationship that she claimed Cameron had been kidnapped, but Cameron refused to cooperate with investigators.

But law enforcement agents found Belle Schreiber, a Chicago prostitute with whom Johnson had an affair years earlier. She agreed to testify against the boxer in 1913, and an all-white jury took less than two hours to convict him.

District attorney Harry Parkin declared the conviction was a victory for the white race and the cause of anti-miscegenation.

“This Negro, in the eyes of many, has been persecuted,” Parkin said. “Perhaps as an individual he was. But it was his misfortune to be the foremost example of the evil in permitting the intermarriage of whites and blacks.”

Johnson skipped bail after the trial and traveled Europe and South America with Cameron before surrendering to American agents at the Mexican border in 1920.

Before his incarceration, Johnson was known to prance around the ring with swagger. He owned a nightclub and wore gold teeth. He once reportedly purchased a pet leopard and took it for walks while sipping champagne.

But by 1921, he was past his prime, and boxing instituted a stricter color barrier. It would be another 16 years until Joe Louis defeated James Braddock in Chicago to win the world heavyweight title.

Johnson fought, often for private audiences, into his late 60s. He died in 1946 after a car wreck in North Carolina, speeding from a restaurant that refused him service. He was 68.

Johnson’s great-great niece, Linda Haywood of Chicago, attended Thursday’s White House ceremony, telling the president and the assembled crowd that her family was for years ashamed of Johnson’s lifestyle and conviction, even if the latter was likely racially motivated.

“When he tweeted, my entire life changed. I appreciate you rewriting history,” she told Trump. “My family can go forward knowing the pain and the shame has been replaced.”

Read more from The Post:

Six months. 5,700 miles. One ocean. Ben Lecomte wants to be first to swim across Pacific.

What the NFL’s new rules for anthem protests really mean for the First Amendment, according to experts

Meet the next owner of the Carolina Panthers. He once called Trump ‘the father of lies.’