WASHINGTON — President Trump called on the nation to seek “unity and peace” on Monday, in the aftermath of one of the deadliest mass shootings in American history. Less than two hours later, he offered conciliatory words to the people of Puerto Rico, promising to visit the hurricane-ravaged island on Tuesday, the day before he travels to Las Vegas.

The week will pose the greatest test yet of whether a president who plays to America’s divisions can also appeal to its sense of national unity, whether it is binding the wounds left by a rampaging gunman or the wreckage left by a deadly hurricane.

Whether Mr. Trump can sustain his empathetic tone over what promise to be two emotional, exhausting days also is an open question — particularly as critics attack his position on gun laws, or if he faces further criticism from local officials in Puerto Rico over the slow-to-start relief effort there. On Monday afternoon, some of the president’s aides were urging him to put off the trip to Puerto Rico because they worried that he could be set off by protests.

Over the weekend, Mr. Trump launched an acrid attack on the mayor of San Juan after she criticized the federal response to Hurricane Maria. While subdued so far about the Las Vegas massacre, he was already facing critics who said his embrace of gun rights abets the kind of violence that targeted a concert crowd outside a casino late Sunday night.