Almost 100 years after their heroic actions during World War I — and thousands of hours of work by loved ones and advocates — two soldiers were honored Tuesday with the Medal of Honor.

Sgts. William Shemin and Henry Johnson were posthumously honored with the nation's highest award for valor during a ceremony at the White House.

"No one who serves our country should ever be forgotten," President Obama said during the ceremony. "We are a nation, a people, who remember our heroes."

The awards for Shemin and Johnson come after years of work by loved ones and advocates of the two soldiers. It's believed that the men — Shemin was Jewish and Johnson was black — were denied recognition for their actions because of discrimination.

Efforts to recognize Shemin and Johnson led Congress to pass an exemption from Medal of Honor rules specifying that heroic actions have to have taken place within five years to be considered, the Associated Press reported.

Shemin's daughter, Elsie Shemin-Roth, worked for years to gather documents in support of the bid for her father, the AP reported.

On Tuesday, she and her sister Ina accepted the award from Obama on her father's behalf.

US President Barack Obama presents the Medal of Honor to Command Sergeant Major Louis Wilson of the New York National Guard, who is accepting on behalf of the late Army Private Henry Johnson, for actions while serving in France during World War I, during a ceremony in the East Room of the White House in Washington, DC, June 2, 2015. Obama also awarded a Medal of Honor to the late Army Sergeant William Shemin for his actions, also during World War I. AFP PHOTO / SAUL LOEBSAUL LOEB/AFP/Getty Images
US President Barack Obama presents the Medal of Honor to Command Sergeant Major Louis Wilson of the New York National Guard, who is accepting on behalf of the late Army Private Henry Johnson, for actions while serving in France during World War I, during a ceremony in the East Room of the White House in Washington, DC, June 2, 2015. Obama also awarded a Medal of Honor to the late Army Sergeant William Shemin for his actions, also during World War I. AFP PHOTO / SAUL LOEBSAUL LOEB/AFP/Getty Images

President Obama, right, presents the Medal of Honor to Command Sgt. Maj. Louis Wilson of the New York National Guard, on June 2 at the White House. Wilson accepted on behalf of the late Army Sgt. Henry Johnson for actions while serving in France during World War I.

Photo Credit: Saul Loeb/AFP via Getty

Johnson's supporters, including New York Sen. Chuck Schumer, pushed on his behalf for decades. They finally made a breakthrough when a trove of military records became available online, including a communique from Gen. John Pershing describing Johnson's heroic actions, according to the Associated Press.

It is never too late to say thank you, Obama said.

"Today America honors two of her sons who served in World War I nearly a century ago," he said. "Some of you have worked for years to honor these heroes, to give them the honor they should have received a long time ago. We are grateful that you never gave up. We are appreciative of your efforts."

On Wednesday, Shemin and Johnson will be inducted into the Pentagon's Hall of Heroes.

Shemin lied about his age and joined the Army on Oct. 2, 1917. He was a member of G Company, 2nd Battalion, 47th Infantry Regiment, 4th Division, American Expeditionary Forces. He was recognized for his actions Aug. 7-9, 1918, during combat operations near Vesle River, Bazoches, France.

"On the western front, the allies were hunkered down in one trench, the Germans in another, separated by about 150 yards of open space, just a football field and a half," Obama said. "But that open space was a blood bath."

Every soldier who ventured out into that space was mowed down, the president said.

Sgt. William Shemin is shown in a uniform overcoat.

Photo Credit: Courtesy of the Shemin family

"Those in the trenches were left with a terrible choice: die trying to rescue your fellow soldier or watch him die, knowing that part of you will die along with him," Obama said. "William Shemin couldn't stand to watch."

Three times, Shemin left the cover of his platoon's trench and crossed the open space, "into the hell of no man's land," Obama said, repeatedly exposing himself to heavy machine gun and rifle fire to rescue his wounded comrades.

"The battle stretched on for days," Obama said.

After officers and senior noncommissioned officers were among the casualties, Shemin "stepped up and took command," Obama said, displaying great initiative under fire until he was wounded Aug. 9.

For his injuries, Shemin received the Purple Heart. He also would later be awarded the Distinguished Service Cross, the nation's second-highest award for valor, according to an Army website dedicated to Shemin.

Shemin was honorably discharged in August 1919 and went on to get a degree from the New York State College of Forestry at Syracuse University.

He started a greenhouse and landscaping business in Bronx, New York, where he raised three children. Shemin died in 1973.

Johnson joined the Army on June 5, 1917. He was assigned to C Company, 15th New York (Colored) Infantry Regiment, an all-black National Guard unit that would later become the 369th Infantry Regiment.

The unit, nicknamed the Harlem Hellfighters, was ordered into battle in 1918, and Johnson and his unit were brigaded with a French Army colonial unit in front-line combat.

Sgt. Henry Johnson of the 369th Infantry Regiment was awarded the French Croix de Guerre for bravery during an outnumbered battle with German soldiers.

Photo Credit: Public domain

Johnson, who Obama said "became a legend," was honored for his actions on May 15, 1918, near the Tourbe and Aisne Rivers, northwest of Sainte-Menehould, France.

Johnson and a fellow soldier were on night sentry duty "along no man's land," Obama said, when they were attacked by a German raiding party of at least 12 soldiers.

"In the pre-dawn, it was pitch black and silent," Obama said. "Then a click, the sound of wire cutters."

The German raiding party fired a hail of bullets at the two Americans, who fired back until they ran out of bullets and then began throwing grenades.

When his fellow soldier was badly wounded, Johnson prevented him from being taken prisoner by German forces.

"Henry refused to let them take his brother-in-arms," Obama said.

A military aide holds the Medal of Honor for the late Army Private Henry Johnson, for actions while serving in France during World War I, during a ceremony in the East Room of the White House in Washington, DC, June 2, 2015. US President Barack Obama also awarded a Medal of Honor to the late Army Sergeant William Shemin for his actions, also during World War I. AFP PHOTO / SAUL LOEBSAUL LOEB/AFP/Getty Images
A military aide holds the Medal of Honor for the late Army Private Henry Johnson, for actions while serving in France during World War I, during a ceremony in the East Room of the White House in Washington, DC, June 2, 2015. US President Barack Obama also awarded a Medal of Honor to the late Army Sergeant William Shemin for his actions, also during World War I. AFP PHOTO / SAUL LOEBSAUL LOEB/AFP/Getty Images

A military aide holds the Medal of Honor for the late Army Sgt. Henry Johnson during a June 2 ceremony at the White House.

Photo Credit: Saul Loeb/AFP via Getty

He stuck another magazine into his rifle, but when it jammed, he swung it at an enemy fighter. He then "grabbed the only weapon he had left, his bolo knife," and went to save his friend, Obama said.

"As the sun rose, the scale of what happened became clear," the president said. "In just a few minutes of fighting, two Americans had defeated an entire raiding party, and Henry saved his fellow soldier from being taken prisoner."

For his valor, Johnson became one of the first Americans to be awarded the French Croix de Guerre avec Palme, France's highest award for valor, Obama said.

"But his own nation didn't award him anything, not even the Purple Heart even though he had been wounded 21 times," Obama said.

After his service, Johnson, crippled from his injuries, couldn't find work and his marriage fell apart. He died in his early 30s and is buried at Arlington National Cemetery. Years later, in 1996, Johnson was posthumously awarded the Purple Heart.

"America can't change what happened to Henry Johnson," Obama said. "We can't change what happened to too many soldiers like him, who went uncelebrated because our nation judged them by the color of their skin and not the content of their character. But we can do our best to make it right."

Command Sgt. Maj. Louis Wilson of the New York National Guard accepted the Medal of Honor on Johnson's behalf.