LAS VEGAS — President Trump comforted the victims of Sunday’s deadly mass shooting and paid tribute to those who tended to them, taking up on Wednesday a harrowing duty of the modern presidency that has nevertheless become numbing in its regularity.

After touring the wreckage of hurricane-ravaged Puerto Rico a day earlier, a somber Mr. Trump headed to Las Vegas, where 58 people were slain by an assailant raining bullets into a crowded country music festival from the blown-out window of his hotel room high above them.

“What I saw today is just an incredible tribute to professionalism, and what they have done is incredible. And you never want to see it again,” Mr. Trump said, after spending about an hour talking to patients in the trauma center of a Las Vegas hospital that received 100 people in the hours after the shooting.

“We met patients that were absolutely, terribly wounded,” the president added. “And the doctors, the nurses, all of the people at the hospital, have done a job that is indescribable.”