President Donald Trump went off the rails during an address to the International Association of Chiefs of Police in Chicago on Monday.

Trump used much of his speech to lob attacks at a local law enforcement official who decided not to attend the event.

He also dumped on the city of Chicago before offering federal government help as an afterthought.

The address seemed more like one of Trump's freewheeling campaign rallies, during which he recounted gruesome details about the death of ISIS leader Abu Bakr al-Baghdadi, attacked illegal immigrants, the actor Jussie Smollett, former President Barack Obama, and the "fake news" media.

Visit Business Insider's homepage for more stories.

President Donald Trump was in his element while speaking at the annual gathering of the International Association of Chiefs of Police in Chicago on Monday.

He went on tangent after tangent, singled out and targeted a local law enforcement official in front of his colleagues, shared gruesome details about the death of ISIS leader Abu Bakr al-Baghdadi, mocked the actor Jussie Smollett, and said he wanted to get undocumented immigrants "the hell out of our country."

By the end of the event, it seemed more like one of Trump's freewheeling campaign rallies than an official address to a law enforcement organization.

The president kicked off his speech by railing against the "fake news" media before veering off and talking about how al-Baghdadi, whose death the president announced on Sunday, is "dead as a doornail."

His comments were extensively documented by CNN reporter Daniel Dale in a Twitter thread.

According to Dale, Trump recounted how US officials would tell him they killed different "low-level" ISIS leaders but that he'd respond, "I never heard of him. I want al-Baghdadi. That's the only one I know."

The president continued and attacked Eddie Johnson, the superintendent of Chicago police.

"There is one person that's not here today," Trump said. "We're in Chicago. I said, 'Where is he? I want to talk to him.' This person should be here. Maybe he could learn something."

Johnson said earlier that he would not attend the event because his values diverged from Trump's. Referring to Johnson's remarks, Trump said, "That's a very insulting statement after all I've done for the police."

The president also said that under Johnson's leadership, Chicago police "certainly don't protect people" and don't cooperate with Immigration and Customs Enforcement (ICE) officials in targeting illegal immigration.

"Eddie Johnson wants to talk about values?" Trump said. "Those values, to me, are a disgrace."

The president also recounted a story in which he said an unidentified man told him what's going on in Chicago is "very sad," that the blame should fall on the Democratic mayor and law enforcement authorities, and that the cops could solve the city's "killing problem" right away if they were given more autonomy.

Trump said the man wanted to hug and kiss him, but that he said, "no, thank you, but you can. It's not my deal, but that's okay."

He then railed against the city of Chicago as a whole, saying it was an embarrassment to the US. "All over the world, they're talking about Chicago," Trump said, adding that in comparison, "Afghanistan is a safe place. It's true."

"If we ever took the Chicago numbers out of our total numbers" of homicides nationwide, Trump said, "the numbers would be incredible. And they already are, even including Chicago."

Trump eventually offered Chicago federal government help, saying "we're waiting for a call from Chicago, because there's no place that we would rather help than Chicago."

He also said he will sign an executive order to create a commission addressing the "systemic challenges that burden law enforcement."

The president also briefly touched on a mass shooting in Dayton, Ohio, in August that killed nine people and injured 27.

"Boom, boom, boom," Trump said as he mimicked how Dayton police officers neutralized the suspected shooter.

The president continued his freewheeling speech, attacking Smollett for being a "scam, just like the impeachment of your president is a scam."

He also thanked Obama for "giving me 142 open judges," and bragged that Republicans gained two Senate seats in the midterms but that "nobody knows that."

After extensively dumping on Chicago, Trump concluded that "when children hear the sirens of your patrol cars, they race to catch a glimpse, because they know that you are the heroes of their streets."