Donald Trump has vowed to close down the government if necessary to build his wall along the Mexico border.
The US president told supporters at a “Make America Great Again” rally in Phoenix, Arizona, that the opposition Democrats were being “obstructionist”.
During the 80-minute speech, he also took aim at the media, blaming them for giving far right groups “a platform”.
But he selectively quoted his initial response to violence at a far-right rally that left one woman dead.
He omitted the controversial claim that “many sides” had to shoulder the blamefor violence in Charlottesville, Virginia.
In his wide-ranging speech, Mr Trump also said he thought he would “probably end up terminating Nafta”, the trade deal with Mexico and Canada.
On North Korea, the president sounded a hopeful note about the possibility of a reduction in tensions over Pyongyang’s missile tests and nuclear programme.
Referring to North Korean leader Kim Jong-un, Mr Trump said: “I respect the fact that he is starting to respect us”.
“And maybe – probably not, but maybe – something positive can come about,” he added.
But while his comments were met with cheers inside the conference centre, anti-Trump protesters who had gathered outside the rally clashed with police after the rally had finished.
Police deployed tear gas after the protesters threw bottles and rocks, Reuters news agency reported.
President Trump began and finished his speech by urging the American people to come together.
But he quickly turned on familiar foes, beginning with the media, which he said had misrepresented his “perfect” words in the wake of the violence in Charlottesville, where Heather Heyer was killed after a car ploughed into a crowd of people protesting against far-right demonstrators including neo-Nazis.
He accused “truly dishonest people in the media and the fake media” of “trying to take away our history and heritage” because, he said, they “don’t like our country”.
He quoted his own initial public response to what happened in Charlottesville.
“This is what I said on Saturday: ‘We’re closely following the terrible events unfolding in Charlottesville, Virginia,’ – this is me speaking. ‘We condemn in the strongest possible terms this egregious display of hatred, bigotry and violence.’ That’s me speaking on Saturday, right after the event,” he said.
But what he actually said on 12 August was: “We condemn in the strongest possible terms this egregious display of hatred, bigotry and violence on many sides, on many sides.”
Mr Trump’s attention then turned to immigration, and to the Democrats who he said were “putting all of America’s safety at risk” by opposing the wall he wants to build along the US’s southern border with Mexico.