The message he intended to send was clear, analysts said: The Islamic State still exists, he is still in charge, and its international network of militants will continue to launch painful, unpredictable attacks. If he felt compelled to reveal himself now, after years in hiding, they said, it was to reassert his authority in the face of a punishing loss in Syria.

“Baghdadi has remained off the grid for so long that his sudden appearance will very likely serve as both a morale boost for ISIS supporters and remaining militants and as a catalyst for individuals or small groups to act,” said Colin P. Clarke, a senior fellow at the Soufan Center, a research organization for global security issues. “He is essentially reasserting his leadership and suggesting that he sits atop the command-and-control network of what remains of the group, not only in Iraq and Syria, but more broadly, in its far-flung franchises and affiliates.”

It was unclear when or where the video was recorded, but the parts that refer to recent events, like the Sri Lanka attack, are addressed in audio, not video, suggesting that it may have been recorded weeks ago with newer audio portions added later.

Much has changed for the Islamic State since Mr. al-Baghdadi appeared at Al Nuri Grand Mosque in the Iraqi city of Mosul in 2014. It was not just a militant group, he said, but a state that would be ruled according to the group’s extreme ideology.

That vision drew in tens of thousands of adherents from across the world, who populated an Islamist proto-state the size of Britain, stretching across Iraq and Syria with millions of people under its rule.