President Trump said he stands with law enforcement during the Annual National Peace Officers' Memorial Service on Capitol Hill, an event to honor law enforcement officers who have died on the line of duty.

"Today we renew our solemn oath that we will never forget," Mr. Trump said before sharing a handful of stories of law enforcement officers.

The president had harsh words for criminals who kill police officers, saying they "should immediately with trial get the death penalty." But he also spent much of his speech criticizing the nation's immigration laws, saying they allow illegal immigrants to enter the country and commit crime.

Get Breaking News Delivered to Your Inbox

May 15 marks Peace Officers Memorial Day, by a resolution under then-President John F. Kennedy. So far in 2019, more than 40 law enforcement officers have died in the line of duty in the U.S.

"On Peace Officers Memorial Day and throughout Police Week, we express our unending gratitude to our Nation's law enforcement officers. Those brave men and women selflessly confront danger to protect our families and defend our communities. We also honor those in blue who have been killed or disabled in the line of duty. We are especially mindful of the tremendous sacrifices of the 106 heroes who laid down their lives last year while protecting their communities."

Mr. Trump has long made a point of voicing his support for the law enforcement community, frequently holding and attending events for the men and women in blue.

"I want to express my gratitude for what you do every day, protecting our communities, our families, our streets and taking down crime," Mr. Trump told the International Association of Chiefs of Police in October of last year. "What you do is keep America safe and no one does that better than you. My administration always honors, cherishes and supports the men and women in blue."

The president's speech comes amid a "little squabble" over trade with China, as the president put it, and as a subpoena war wages on between the White House and Capitol Hill. An agreement has been reached for Mr. Trump's son Donald Trump Jr. to testify before the Republican-led Senate Intelligence Community, as questions linger from that committee's Russia probe.