A day of noisy but largely peaceful protests at Donald Trump's speech in Phoenix turned unruly as police fired pepper spray at crowds.
Police said rocks and bottles were thrown at them.
A haze enveloped the night sky as protesters and police clashed outside the convention centre where the president had just wrapped up his speech.
Mr Trump had opened his political rally with calls for unity and an assertion that "our movement is about love", but he then erupted in anger.
He blamed the media for widespread condemnation of his response to deadly violence at a white supremacists' protest in Charlottesville, Virginia, and shouted that he had "openly called for healing, unity and love" after the tragedy and had been misrepresented in news coverage.
Protesters outisde the Phoenix event fled the scene coughing as an officer in a helicopter used a speaker to urge them to leave the area.
Officers responded with pepper spray to break up the crowd after people threw rocks and bottles and dispersed gas, police spokesman Jonathan Howard said.
Four people were arrested on charges related to the protest, and one was arrested on an unrelated warrant, Police Chief Jeri Williams said.
Inside the convention centre, Mr Trump had read from his responses to the racially charged violence in Charlottesville when a woman was killed by a man who ploughed a car through counter-protesters, but he skipped over his controversial observation that "many sides" were to blame.
That assertion prompted Democrats and many Republicans to denounce him for not unequivocally calling out white supremacists and other hate groups.
"You know where my heart is," Mr Trump told the crowd of thousands into the Phoenix hall. "I'm only doing this to show you how damned dishonest these people (the media) are."
"They don't want to report that I spoke out forecefully against bigotry, hatred and violence."
President Trump also claimed his hard line against North Korea has had a positive impact:
"I respect the fact that I believe he is starting to respect us. And maybe, probably not, but maybe something positive can come about," he said.
Earlier, North Korea condemned Mr Trump as a leader who frequently tweets "weird articles of his ego-driven thoughts" and "spouts rubbish" to give his assistants a hard time.
The official Korean Central News Agency made the comments in response to tough talk in Washington and Seoul over threats posed by the North's nuclear and missile programmes.
It criticised South Korea's "puppy-like" defence minister, who it said was "running wild" while relying on the "master of the White House".
Well after his appearance had ended, Mr Trump sent a tweet saying: "Not only does the media give a platform to hate groups, but the media turns a blind eye to the gang violence on our streets."
The broadside against the media was one of several detours he took from his prepared remarks at a rally where he was introduced by vice president Mike Pence and other speakers appealing for unity and healing.
He acknowledged that his own advisers had urged him to stay on message, but he simply could not.
He said he had aimed to avoid "controversy" by not immediately pardoning former sheriff Joe Arpaio, who is awaiting sentencing in Arizona after his conviction in federal court for disobeying court orders to put a stop to his immigration patrols, but the president left little doubt he wanted to do it.
"I'll make a prediction: I think he's going to be just fine," he said.
And he skewered both of Arizona's Republican senators, insisting that his refusal to mention their names showed a "very presidential" restraint.
He said his aides had begged him, "Please, please, Mr President, don't mention any names. So I won't." Yet clearly described John McCain as the reason Congress did not repeal and replace the much-maligned Affordable Care Act, and he labelled Jeff Flake as "weak" on borders and crime.
Authorities were on high alert as thousands lined up in powerful heat to attend Mr Trump's first political rally since the violence in Charlottesville.
The outdoor temperature remained in the late 30s as the rally began and Phoenix Fire Department, said at least 48 people were treated for heat-related problems, most for dehydration.