'We Are Building a Safe, Strong & Proud America': Trump Delivers SOTU Address

'Legend from Louisiana': Trump Honors 2017's American Heroes at State of the Union

President Donald Trump said in his State of the Union address that illegal immigration must be curtailed, and programs like the visa lottery and chain migration must be ended.

Near the end of his remarks on immigration, boos could be heard from some in the gallery.

He played off the term "DREAMer," a reference to illegal immigrants who came to the U.S. as minors.

"My duty... is to defend Americans," he said. "Because Americans are dreamers too."

Trump praised the work of ICE Agent Celestino "C.J." Martinez, whose unit has arrested hundreds of illegal immigrants in the state of New York.

Trump said violent Salvadoran gang MS-13 ordered Martinez murdered, but added that the agent continued to work despite the threat.

The president called on Republicans and Democrats to work toward a compromise on illegal immigration, calling on lawmakers to include a path to citizenship for up to 1.8 million DREAMers who "show good moral character."

He said the compromise should include an end to chain migration and the visa lottery program.

Trump said both those programs contributed to two recent terror attacks in New York City - one where a man tried to blow up a bomb in a concourse below 42nd Street in a busy transit hub, while in the other case, a man drove a truck down a bike path.

"It is time to begin moving towards a merit-based immigration system - one that admits people who are skilled, who want to work, who will contribute to our society, and who will love and respect our country," Trump said.

Trump was notably booed when he called for the end of chain migration.

Watch more above.

Social Media Reacts to Trump's SOTU Address

WATCH: Debate Heats Up When Tucker Challenges Dem Rep on 'Open Seat' for Deportee at SOTU