WASHINGTON — President Donald Trump bestowed the Medal of Honor on a U.S. soldier Friday for his role in a daring 2015 mission to rescue dozens of hostages who were set to be executed by Islamic State militants in Iraq.

Trump picked the 19th anniversary of the Sept. 11 attacks to honor Sgt. Maj. Thomas “Patrick” Payne, who negotiated a barrage of enemy gunfire and repeatedly entered a burning building in a harrowing effort that saved nearly 70 hostages.

The White House, in a statement, highlighted Payne’s “small-town America” upbringing and his family’s commitment to public service. The soldier grew up in Batesburg-Leesville and Lugoff, South Carolina. His wife Alison is a nurse, his father a police officer, and his two brothers serve in the Army and Air Force.

Payne was assigned to lead a team clearing one of two buildings known to house hostages in a nighttime operation in the northern Iraq province of Kirkuk. The Oct. 22, 2015, raid quickly became complicated.

Kurdish forces working with U.S. troops attempted to blast a hole in the compound’s outer wall, but the blast failed. The explosion alerted the ISIS militants, who opened fire on the Kurdish forces.

Payne, a sergeant first class at the time of the mission, and his unit climbed over a wall to enter the prison compound. The soldiers quickly cleared one of the two buildings. Once inside the building, the unit encountered enemy resistance. The team used bolt cutters to break the locks off the prison doors, freeing 38 hostages, according to the White House.

Moments later, an urgent call over the radio came from other task force members engaged in an intense gun fight at the second building.

In this image from video provided by the U.S. Army, then-Sgt. 1st Class Thomas Payne is interviewed as a winner of the 2012 Best Ranger competition at Fort Benning, Ga., on April 16, 2012. Payne will receive the Medal of Honor, the U.S. military’s highest honor for valor in combat, for actions during a daring 2015 raid in Iraq that rescued about 70 hostages who were set to be executed by ISIS militants, The Associated Press has learned. Sgt. Maj. Payne will receive the honor in a White House ceremony on the 19th anniversary of the Sept. 11, 2001, terrorist attacks. (Lori Egan/U.S., Army via AP)

Between 10 to 20 Army soldiers, including Payne and Master Sgt. Joshua L. Wheeler, headed toward the second building that was partially on fire. Kurdish commandos were pinned down by the gunfire.

Wheeler was shot and killed, the first American killed in action since the U.S. launched renewed military intervention in Iraq against the Islamic State in 2014. Twenty ISIS fighters also were killed in the operation.

The team scaled a ladder onto the roof of the one-story building under machine-gun fire. From their roof-top vantage, the commandos engaged the enemy with hand grenades and small arms fire, according to an official account.

At that point, ISIS fighters began to detonate their suicide vests, causing the roof to shake, Payne said in a statement.

ISIS fighters continued to exchange gunfire with the commandos as they entered the building. Once the door was kicked opened, both American and Kurdish commandos escorted about 30 more hostages out of the burning building.

Payne reentered the building two more times to ensure every hostage was freed. He had to forcibly remove one of the hostages who was too frightened to move.

Payne joined the Army in 2002 as an infantryman and quickly made his way into the Rangers. He has deployed several times to combat zones as a member of the 75th Ranger Regiment and in various positions with the U.S. Army Special Operations Command.

He was initially given the Army’s second-highest award, the Distinguished Service Cross, for the special operations raid, which was upgraded to a Medal of Honor. Payne received a Purple Heart for a wound sustained in a 2010 mission in Afghanistan.