WASHINGTON — President Trump, in his first public remarks since returning from a nine-day overseas trip, paid tribute to fallen American troops in a traditional Memorial Day ceremony on Monday, saying they “died in war so we could live in peace.”

In one of the annual rites of every presidency, Mr. Trump traveled the short distance over the Potomac River to Arlington National Cemetery in Virginia to honor the soldiers, sailors, airmen and Marines who were killed in service to their country.

“Words cannot measure the depth of their devotion, the purity of their love or the totality of their courage,” Mr. Trump told an audience that included relatives of slain service members. “We only hope that every day we can prove worthy, not only of their sacrifice and service, but of the sacrifice made by the families and loved ones they left behind. Special, special people.”

The Run-Up

The podcast that makes sense of the most delirious stretch of the 2016 campaign.

Mr. Trump was accompanied by Vice President Mike Pence and preceded at the podium by Defense Secretary Jim Mattis and Gen. Joseph F. Dunford Jr., chairman of the Joint Chiefs of Staff. The president, who has been under siege by investigations into contacts between Russia and his associates, including his son-in-law, Jared Kushner, smiled and seemed to enjoy the enthusiastic welcome by a supportive crowd.

Sticking closely to his prepared text, Mr. Trump offered no insight into his thinking about how to proceed in the various wars that the United States is currently fighting, including the battle against the Islamic State in Iraq and Syria or the war in Afghanistan. The Pentagon has proposed sending another 5,000 troops to Afghanistan to bolster the force that has been fighting there since shortly after the Sept. 11, 2001, attacks. Some of Mr. Trump’s political advisers, including Stephen K. Bannon, worry about a slippery slope into nation building, but the president has not publicly indicated which way he is leaning.

Instead, Mr. Trump used the occasion to single out several service members who have died in combat in recent years and also honored former Senator Bob Dole, Republican of Kansas, who was wounded in Italy during World War II and attended Monday’s event.

“They were all angels sent to us by God, and they all share one title in common, and that is the title of hero, real heroes,” he said. “Though they were here only a brief time before God called them home, their legacy will endure forever.”

Like his three most recent predecessors, Mr. Trump never served in combat or the active-duty military, and at one point during his campaign last year he offended veterans by denigrating the service of Senator John McCain, the Arizona Republican, a Navy pilot who spent five and a half years as a prisoner of war in North Vietnam. “He’s not a war hero,” Mr. Trump said at the time. “He was a war hero because he was captured. I like people who weren’t captured.”

Mr. Trump has never apologized for those remarks, but in his speech on Monday he lavished warm praise on other veterans. He singled out John F. Kelly, a retired four-star general now serving as secretary of homeland security whose son, Second Lt. Robert M. Kelly of the Marines, was killed when he stepped on a land mine in 2010 in southern Afghanistan.

“We grieve with you, we honor you and we pledge to you that we will always remember Robert and what he did for all of us,” the president said.

Mr. Trump also cited Specialist Christopher Horton, a member of the Oklahoma National Guard, who died in a gun battle with insurgents in Afghanistan in 2011, and Maj. Andrew Byers, a member of the Green Berets who was killed last year during an attack on a Taliban bastion.

“Chris sacrificed his life to protect his fellow soldiers and to protect all Americans,” Mr. Trump said. Addressing Mr. Horton’s weeping widow, Mr. Trump added, “Jane, America grieves with you.”

The president said that Major Byers raced through gunfire to save other soldiers. To his parents, Mr. Trump said, “We stand in awe of your son and his courageous sacrifice.”

After his speech, Mr. Trump also stopped by the cemetery’s Section 60 to lay flowers at Lieutenant Kelly’s gravestone. Section 60 contains the remains of many other service members who have died in the wars in Afghanistan and Iraq.

A reporter asked Mr. Kelly what Memorial Day meant to him. “Sad,” Mr. Kelly replied.