President Trump, in his first State of the Union address before a divided Congress, railed against "the politics of revenge" and "partisan investigations" as he appealed for unity at a time when Washington is struggling to break a deadlock over border security funding that threatens to trigger another government shutdown in a matter of days.

Touting economic gains during his first two years in office, as well as legislative wins on issues like criminal justice reform, Trump warned Tuesday that deepening partisan tensions undermine America's progress.

ABRAMS BLASTS TRUMP OVER SHUTDOWN 'DISGRACE'

"An economic miracle is taking place in the United States -- and the only thing that can stop it are foolish wars, politics or ridiculous partisan investigations," Trump said, in an apparent reference to Democratic congressional probes of his administration and possibly to Special Counsel Robert Mueller's Russia investigation. "If there is going to be peace and legislation, there cannot be war and investigation. It just doesn't work that way."

The president called for unity -- but at the same time, did not back down from his insistence that Congress fund border security measures including a border wall. Trump, in graphic terms, also weighed in on the late-term abortion debate in Virginia, accusing embattled Democratic Gov. Ralph Northam of saying “he would execute a baby after birth.” Northam, who is embroiled in a separate scandal over racist photos on his medical school yearbook page, has pushed back against the accusation that he discussed infanticide while commenting last week on an abortion bill.

“To defend the dignity of every person, I am asking Congress to pass legislation to prohibit the late-term abortion of children who can feel pain in the mother's womb,” Trump said.

He focused much of his speech on his signature issue of border security, calling for new funding for a border wall and saying the U.S. has a "moral duty" to create an immigration system that protects the lives and jobs of "our citizens.” The wall was at the heart of the standoff that triggered the longest government shutdown in U.S. history in December. That shutdown was ended with a stopgap funding bill, but the Feb. 15 funding deadline to pass a new measure is fast-approaching, without a deal in place.

"Congress has 10 days left to pass a bill that will fund our government, protect our homeland, and secure our Southern Border," Trump said. "Now is the time for Congress to show the world that America is committed to ending illegal immigration and putting the ruthless coyotes, cartels, drug dealers, and human traffickers out of business."

The president has suggested he could declare a national emergency to secure funding for the border wall if Congress doesn’t act, though he did not make such a declaration on Tuesday. Trump insisted a barrier will be built on the U.S.-Mexico border, while pledging that his administration will “never abolish our heroes from ICE,” amid calls from some Democrats to gut the agency.

"In the past, most of the people in this room voted for a wall -- but the proper wall never got built. I will get it built,” Trump said, adding, “simply put, walls work and walls save lives.”

STATE OF THE UNION 2019, TRUMP'S SECOND ADDRESS: WHO'S ATTENDING?

The president, meanwhile, said he’s “alarmed by new calls to adopt socialism in our country,” amid the popularity in the Democratic Party of Democratic socialists like New York Rep. Alexandria Ocasio-Cortez.

“America was founded on liberty and independence -- not government coercion, domination and control,” Trump said. “We are born free, and we will stay free. Tonight, we renew our resolve that America will never be a socialist country.”

During Tuesday's speech, the president took credit for an “unprecedented economic boom,” boasting of 5.3 million new jobs created. He also highlighted Republican efforts to eliminate “the very unpopular ObamaCare individual mandate penalty” as part of the tax reform.

On foreign policy, Trump -- who announced in December that he was withdrawing U.S. forces in Syria -- said it is time “to give our brave warriors in Syria a warm welcome home.” He also said he has “accelerated our negotiations” to reach a political settlement in Afghanistan.

“Great nations do not fight endless wars,” he said.

The tame and at-times jovial mood in the chamber belied the intense partisan rancor surrounding the address.

At one point, House Democratic women wearing white gave the president a standing ovation when he said there are “more women serving in Congress than ever before.” Reacting to the Democratic applause, Trump quipped, “You weren't supposed to do that.”

Calling on Democrats to work with Republicans, Trump said his agenda is not a Republican or Democratic agenda but "the agenda of the American People.”

"The decision is ours to make," the president said, urging an end to "the politics of revenge, resistance and retribution." He said, "We must choose between greatness or gridlock, results or resistance, vision or vengeance, incredible progress or pointless destruction."

Still, Trump's appeals for unity are unlikely to win over many of his Democratic critics in Congress. Before Trump even delivered his speech, California Sen. Kamala Harris, a 2020 Democratic presidential candidate, said, "We will hear insincere appeals to unity."

Also in the audience were several other Democrats running to challenge Trump in 2020, including Cory Booker of New Jersey, Elizabeth Warren of Massachusetts and Kirsten Gillibrand of New York.

The lead-up to this year’s speech to Congress has been uniquely dramatic: House Speaker Nancy Pelosi initially invited the president to deliver the State of the Union on Jan. 29. But she later moved to delay the speech, citing the ongoing partial government shutdown. The president then abruptly denied military aircraft to Pelosi for a foreign trip.

Pelosi, who regained the speakership after Democrats re-took the House in November, was seated behind Trump in the House chamber.

Tuesday night’s date for this year’s State of the Union was ultimately agreed upon after the president in January signed a bill reopening the government for three weeks. But that standoff is not resolved. Trump has refused to sign a government funding bill that does not include money for his long-promised border wall, and has called on Congress to make a deal with him on border security ahead of a Feb. 15 funding deadline.

PRESIDENT TRUMP'S STATE OF THE UNION GUESTS TO INCLUDE BULLIED STUDENT JOSH TRUMP, ALICE JOHNSON

Democratic National Committee Chairman Tom Perez said after the speech that Trump's "words tonight were hollow."

"His calls for unity were undermined by the most divisive agenda in modern history," Perez said. "His vague platitudes were punctured by lies, fearmongering, and broken promises."

Democrats tapped Stacey Abrams, who lost the Georgia gubernatorial race in November to Republican Brian Kemp, to deliver the Democratic response to the president. "America is made stronger by the presence of immigrants -- not walls," said Abrams, who is being encouraged to run for the Senate in 2020 against incumbent Republican Sen. David Perdue.

She also said, "Even as I am very disappointed by the president’s approach to our problems – I still don’t want him to fail. But we need him to tell the truth, and to respect his duties and respect the extraordinary diversity that defines America."

REPUBLICANS TROLL STACEY ABRAMS OVER ‘SOUR GRAPES’ DEFEAT, AHEAD OF DEMOCRAT’S SOTU RESPONSE

Among the president's guests Tuesday night were Delaware 6th-grade student Joshua Trump, who says he has been bullied at school because of his name. Family members of Gerald and Sharon David, the Nevada couple murdered last month allegedly by an illegal immigrant, were also in attendance, as well as Alice Johnson, whom Trump granted clemency last year while she was serving a life-term sentence without parole for a nonviolent drug crime.

Fox News’ Judson Berger, Chad Pergram, Gregg Re and The Associated Press contributed to this report.