Arpaio was convicted last month of criminal contempt for ignoring a federal judge's order to stop detaining people because he merely suspected them of being undocumented immigrants. A major Trump supporter during last year's campaign, he awaits sentencing.
"So was Sheriff Joe convicted for doing his job?" Trump asked the crowd. "You know what, I'll make a prediction: I think he's going to be just fine, okay? But I won't do it tonight because I don't want to cause any controversy. But Sheriff Joe should feel good."
Trump last week told Fox News that he was "seriously considering'' a pardon for Arpaio and said he might do it soon, sparking speculation he would use Tuesday's campaign rally here to make the move.
In a speech that stretched well over an hour, Trump also expressed frustration with efforts to negotiate with Canada and Mexico to improve NAFTA, saying he was more likely to terminate the deal. He also blamed "obstructionist Democrats" for standing in the way of funding for a U.S.-Mexico border wall and suggested a government shutdown might be needed to force their hand. And Trump called for ending the filibuster rule requiring 60 votes for many issues in the Senate, a move that Republican leaders have refused to embrace.
At the outset of the rally, Trump selectively recounted the series of statements he made in the days following the melee in Charlottesville, arguing that he "spoke out forcefully against hatred and bigotry and violence" but that the media — whom he called "sick people" — refused to report it properly.
The scene as pro-Trump supporters faced off with peace activists in Phoenix
"You know where my heart is," Trump said, before pulling a copy of his first of three statements on the violence out of his suit coat and reading it to his audience. He later accused the media of giving a platform to the hate groups that were central to the violence in Charlottesville that led to three deaths.
Following his comments last week, Trump was criticized by Democrats and Republicans alike for blaming "both sides" for the violence and saying that "fine people" had marched along with white supremacists to protest the removal of a Confederate statue. He did not mention either of those remarks Tuesday.
The rally, organized by Trump's reelection campaign, came as the president continues to face criticism for his response to Charlottesville and feuds with fellow Republicans in Congress whose cooperation he will need to kick-start his sputtering legislative agenda next month.
Phoenix Mayor Greg Stanton (D) had urged Trump to not come to his city this week, saying that it was too tense of a time in the wake of the deadly Charlottesville clash between white nationalists and counterprotesters and that Trump could be setting the stage for more violent strife here. He also said that a pardon of Arpaio could make the situation even more dire.
Inside a partially filled Phoenix Convention Center hall, Trump was given a hero's welcome from supporters who chanted "USA! USA! USA!" and waved signs reading "Drain the Swamp," "Make America Strong Again" and "Make America Proud Again."
"You were there from the start, you've been there every day since, and believe me, Arizona, I will never forget it," Trump said at the start of his remarks, referencing a large crowd he drew at the site early in his campaign. His crowd Tuesday night numbered in the thousands but did not completely fill the hall at the convention center.
Before his arrival, Trump traveled to Yuma, where he received a closed briefing on border protection — something he touts as being among his administration's successes — and greeted Marines and their families, signing a couple autographs on camouflage hats.
Trump was greeted at the airport by Arizona Gov. Doug Ducey (R), who was not expected to attend the rally. Nor were the state's two Republican senators, with whom Trump has been openly sparring.
There was a heavy police presence in downtown Phoenix, with law enforcement seeking to maintain civility between Trump supporters and detractors. Police said three people were arrested related to protests.
After the rally ended, protesters remained in the streets near the convention center, chanting, "No Trump! No KKK! No racist U.S.A!"
About two blocks from the convention center, police told demonstrators to leave the roads or face arrest. Some stood defiant, and officers responded with blasts of gas that made their eyes sting. Those who lacked goggles and bandanas dashed away.
Matthew Burke, a 38-year-old Phoenix resident who works in finance, was trying to leave the area when the substance burned his eyes. He dumped a bottle of water down his face, neck and gray Obama T-shirt.
Police later said they had used pepper balls.
Before the rally, Uzma Jafri, a 40-year-old doctor from Phoenix, walked through the crowds of Trump supporters and protesters with a backpack of medical supplies. She said she came here to quickly treat anyone if violence broke out.
"My ethical background, and my moral background, is to assist anyone who needs it — regardless of if they hate me," said Jafri, who poured a bottle of water over her black hijab in the 107-degree heat.
Brian Ratchford came to the event armed with a .357-caliber gun to defend Trump supporters if things got out of hand
"He's an American for Americans," said Ratchford, 47, of Tucson. What Trump said after Charlottesville "was perfect — people on both sides were causing the problems," said Ratchford, who had been outside the convention center since 10 a.m.
Tuesday night's event was part of a familiar pattern for Trump.
When he finds himself under attack or slipping in popularity, he often holds a rally in a place like this: a diverse blue city that's home to liberal protesters but surrounded by red suburbs and rural towns filled with Trump supporters who will turn out in droves.
It happened in the first weeks of his presidential campaign, when he was dismissed as a sideshow and criticized for his comments on undocumented immigrants — only to be greeted by thousands of fans, along with protesters, at a rally at the convention center.
Then in March 2016, when Trump grew frustrated that he still had not become the presumptive Republican nominee, he planned a massive rally in Chicago that attracted thousands of supporters but was canceled at the last minute because of the high number of protesters. This March, when his presidency seemed constantly under attack, Trump held a rally in Nashville that attracted at least 2,500 protesters.
Unlike rallies in states that are solidly Republican, these events allow Trump to highlight the deep division in the country — and force voters to pick a side.
In Phoenix, campaign organizers expected more than 10,000 supporters to show up at the convention center on Tuesday night, and numerous counterprotests were planned for outside the rally. Local activists said they hoped to outnumber the rallygoers, sending a clear message to the president after the Charlottesville rally this month that attracted neo-Nazis and white supremacists.
"By coming here in a time of national crisis and a national question of where people stand, he is doubling down on his bigotry, continuing to race-bait and speak to his base," said Carlos García, executive director of Puente Arizona, which advocates for migrants.
Phoenix is home to some of the most organized progressive activists in the country, and they have provided a much-studied example of how to fight at a grass-roots level to challenge lawmakers and change policies that target undocumented immigrants. The Phoenix area gave liberals one of their few victories last November: The ouster of Arpaio, the longtime Maricopa County sheriff, who was accused of encouraging his deputies to employ racial profiling and enforce federal immigration laws in the Phoenix suburbs.
In July, Arpaio was convicted of criminal contempt in Arizona for ignoring a judge's order to stop detaining people because he merely suspected them of being undocumented immigrants. His sentencing is scheduled for Oct. 5, and he faces up to six months in prison.
Last week, Trump told Fox News the former sheriff is a "great American patriot" who has "done a lot in the fight against illegal immigration." Arpaio told CNN that he had not been invited to attend the Tuesday night rally.
White House press secretary Sarah Huckabee Sanders told reporters traveling with the president Tuesday that Trump was not planning to announce a pardon for Arpaio at the rally.
"There will be no discussion of that today at any point, and no action will be taken on that front at any point today," she said.
A pardon — whenever it might come — would be likely to ignite the anger of hundreds of activists who spent more than a decade peacefully pushing for change through traditional channels, as well as the voters who chose not to reelect him.
"Joe Arpaio terrorized immigrant communities of color across Arizona for decades and broke the law repeatedly when his actions caught up with him," Alejandra Gomez, co-executive director of Living United for Change in Arizona, said in a statement after the rally. "For someone with Arpaio's record, even the idea of a pardon is a slap in the face to immigrants and communities of color — and one we will fight tooth and nail."
Early Tuesday morning, local authorities closed streets near the convention center and installed barricades along the sidewalks aimed at keeping protesters separated from rallygoers.
Protest organizers said one challenge would be managing the hundreds of people not affiliated with their groups who showed up wanting to make a statement. Organizers and local lawmakers were urging a peaceful demonstration.
While Democrats and immigration rights activists have been holding news conferences and speaking out against the president this week, Republicans have been quiet. No one answered the phone at the Arizona GOP offices on Monday or Tuesday.
Arizona's two Republican senators, John McCain and Jeff Flake, have at times been critical of the president. Trump has tweeted praise of Kelli Ward, a former state lawmaker with far-right views and a long-shot Senate candidate who is challenging Flake.
In the hours leading up to the rally, a few dozen Ward supporters were out on the streets wearing yellow T-shirts reading "TRUMP 2016/WARD 2018" on the front and "MAKE ARIZONA GREAT AGAIN" on the back.
Trump did not mention either McCain or Flake during his remarks, but took jabs at both during his speech.
His first event at the convention center was on July 11, 2015, a few weeks after he announced he was running for president and gave a rambling speech that cast undocumented immigrants as criminals and "rapists."
Although those remarks prompted criticism and led several corporations to cut their business ties with him, the support for his campaign was evident in Phoenix, where he had to upgrade to a larger venue and then still had to turn away many supporters — a showing that shocked many Arizonans.
Lourdes Medrano in Phoenix and Philip Rucker in Washington contributed to this report.