With a backdrop of supporters in red shirts bearing the words "Cops for Trump," President Donald Trump on Thursday night vilified Minneapolis Mayor Jacob Frey while embracing Lt. Bob Kroll, the leader of the city's police union.

Frey shot back that the president brought exactly the "message of hatred" he had warned about.

Frey and Kroll, head of the Minneapolis Police Officers Federation, had sparred in the days leading up to the president's rally at Target Center after Frey and the Police Department enacted a policy prohibiting officers from appearing in uniform while supporting political candidates.

While Frey said they had considered making the change for a long time, Kroll said it was a political swipe against Trump. So the police union responded by designing the red "Cops for Trump" T-shirts, and Kroll appeared on Fox News to express his support for the president. During his speech, Trump brought up Kroll and a group of others wearing the red shirts to the podium.

"I think your very weak mayor made a mistake when he took them on," Trump told the audience.

Trump positioned the two as enemies, reiterating his respect for law enforcement and implying Frey did not support police.

Last week, Frey had said that the city's Police Department was not partisan and that the new uniform policy was being considered by Police Chief Medaria Arradondo since before Frey was elected mayor. "Bob Kroll knows exceedingly well that this has been a conversation for quite some time, and if he says otherwise, he's not telling the truth and he knows it," he said.

Frey had rolled out the unwelcome mat just minutes after Trump's campaign announced he would hold a rally in downtown Minneapolis.

"While there is no legal mechanism to prevent the president from visiting, his message of hatred will never be welcome in Minneapolis," Frey said last month.

That set the tone for online barbs between the two leading up to Thursday. On the podium, Trump made Frey a target, though he never mentioned him by name.

"Minneapolis, you got a rotten mayor. You gotta change your mayor," he said.

Following those comments, Frey said in an interview that "the fact that he doesn't think I'm a good mayor doesn't surprise me in the least."

"As far as his speech goes, I said that his message of hatred wasn't welcome in Minnesota, and this is exactly what I was talking about," Frey said.

In the hours before the rally, Frey issued a proclamation declaring Thursday "Love Trumps Hate Day" and put out a fundraising e-mail saying that Trump "has attacked our city because he thinks he can win by dividing us."

"We've all seen what kind of rhetoric is pushed at these rallies," the e-mail said. "It is hateful, it is divisive, and we reject it here in Minneapolis."

Trump also attacked the state's Somali population, saying that refugees would not be resettled in cities without the consent of mayors.

Frey quickly tweeted: "Consent given. Immigrants and refugees are welcome in Minneapolis."