A pandemic was raging, the economy was shaky, national divisions were deep and the president's political foil, whom he had defeated in the election a year ago, stood accused of trying to subvert the government.

The president wasn't Joe Biden, but Warren G. Harding. His opponent wasn't Donald Trump, but Eugene V. Debs.

And almost exactly a century ago, when Harding found himself in this position, he decided that the best way to heal the country was to grant absolution to his onetime rival.

Just before Christmas in 1921, Harding, a conservative and mild-mannered Republican, commuted the 10-year sentence of the Socialist Debs, who had been convicted of violating the Espionage Act of 1917. On Dec. 26, Harding welcomed Debs to the White House, eager to meet him before he returned to civilian life after being released from federal prison in Atlanta.

No members of the press were allowed to witness the meeting, but according to multiple accounts, the president told Debs: "Well, I've heard so damned much about you, Mr. Debs, that I am now glad to meet you personally."

Though most of his advisers and the first lady argued against the commutation, Harding believed that his use of the pardon power would help heal a divided nation after the deadliest war in world history and a flu pandemic that killed at least 675,000 Americans and tens of millions around the globe.

Stability was in short supply when Harding took office in March 1921. Republicans despised his predecessor, Woodrow Wilson, believing his plan for a League of Nations would undercut the nation's sovereignty. The Senate blocked the peace treaty Wilson had spent six months negotiating in Paris in 1919. Wilson himself probably contracted the flu during the negotiations, then suffered a stroke or a series of strokes in September 1919 that disabled him almost entirely and left the country leaderless for the last 18 months of his second term.

The economy, overheated from war expenditures, collapsed, and soldiers returning from Europe drove up unemployment numbers.

Many Americans saw socialists and anarchists as the country's primary threat. The Bolshevik Revolution in Russia had turned dark, and there was a palpable fear that revolution might spread among labor activists and their Socialist leaders in the United States. In the summer of 1919, anarchists sowed terror by sending packages filled with dynamite to dozens of leading officials across the country. One attack, on Wilson's attorney general's home on R Street NW in Washington, blew up the would-be bomber and shattered all the front windows of the home across the street, occupied by Franklin and Eleanor Roosevelt.

Race riots racked American cities as Whites reacted to large numbers of Black soldiers returning from Europe. The area of Tulsa known as Black Wall Street was destroyed less than three months after Harding took office; Harding responded four months later with a civil rights speech in Birmingham, Ala., declaring democracy a lie if African Americans were not afforded full political rights.

Debs, meanwhile, was coming off his fifth campaign for president on the Socialist ticket. He had run against Harding in 1920 from his prison cell in Atlanta, winning almost a million votes. (Harding received 16 million votes, to 9 million for Democrat James Cox and his running mate Franklin D. Roosevelt.)

Debs had been imprisoned by the Wilson administration for speaking out against U.S. participation in World War I. His crime: a speech in Canton, Ohio, at a party picnic in 1918, in which he criticized what he saw as a diabolical capitalist war. He was charged and convicted under the Espionage Act of 1917 for allegedly obstructing recruitment in the draft. Even liberal Supreme Court Justice Oliver Wendell Holmes affirmed Debs's conviction in an opinion he later regretted.

Debs, 66 and in fragile health, seemed destined to die a martyr in the Atlanta prison. Enter Harding.

Harding instructed his attorney general, Harry Daugherty, to send for Debs in the weeks following his inauguration in March 1921. Debs was permitted to leave prison in civilian garb without guard and to travel secretly to Washington, D.C., to meet with Daugherty to discuss a pardon or clemency. After a three-hour conversation with Daugherty, Debs returned by train to the Atlanta prison. Harding made up his mind to commute Debs's sentence to time served once he was able to formally end the war with Germany and its allies, an event that took place Nov. 14, 1921.

The question then arose: Should the president require Debs to sign a loyalty oath as a condition of the clemency? "It is my judgment that this sort of pledge would be of little avail," Harding wrote Daugherty. "It would have the savor of bargaining for amnesty, and I doubt that it would meet with any marked degree of approval."

Harding surprised even his friends when he took the bold step to make peace with a Socialist leader. He knew Americans wanted reconciliation and recovery - a promise of "normalcy" was at the center of his 1920 campaign.

On the same day he freed Debs, Harding commuted the sentences of 23 other political prisoners, activists and Industrial Workers of the World union members who spoke out against the war. In an executive statement issued two days before Christmas, the White House characterized the list of those released as "in the main, made up of those who opposed the war in one way or another."

However, Harding believed there were limits to executive clemency, and his statement made clear that those who opposed the government through acts of violence would never be considered for pardon or parole. The statement read: "The Department of Justice has given no recommendation in behalf of the advocates of sabotage or the destruction of the government by force, and the President let it be known he would not consider such cases."

Harding, according to historian Ron Radosh, said: "I thought the spirit of clemency was quite in harmony with the things we were trying to do in Washington; that Debs had never been guilty of any overt act; that he never countenanced destruction of government by force, and probably I could persuade him to become a factor in contributing to tranquility throughout the land."

That's where Debs's actions differed from those of the insurrectionists who sought to topple the democratic process on Jan. 6, 2021. Harding believed there was a proper use of the pardon power to mend breaches, even seemingly vast gulfs, in the political arena - but that those who would sabotage or seek to destroy the government by force should never be included.

James D. Robenalt is the author of four nonfiction books, including "The Harding Affair: Love and Espionage During the Great War." He also wrote the Harding chapter in "The Presidents and the Constitution."