Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Iraqi Prime Minister Haider al-Abadi has arrived in Mosul to declare victory over ISIS in the city, his office said.

Small pockets of fighting were still ongoing near the Tigris river, but the militants are expected to be defeated, a spokesman told NBC News.

A picture of his arrival was posted on his official Twitter feed.

"The commander in chief of the armed forces (Prime Minister) Haider al-Abadi arrived in the liberated city of Mosul and congratulated the heroic fighters and the Iraqi people for the great victory," said a statement from his office.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Related: In Battle Against ISIS in Syria and Iraq, Civilians Suffer Most

State television later showed Abadi touring Mosul on foot alongside residents of Iraq's second-largest city, according to the Associated Press.

During a meeting with commanders in Mosul, Abadi said the battle against ISIS is "settled" and the victory in Mosul "is by our hand," according to a statement released by his office late Sunday night.

During the last day, Abadi said in the statement, a significant number of ISIS fighters were killed — though security forces were still trying to free civilians from 50 to 100 homes where they were being used as human shields.

"We came today to Mosul to supervise the battle that left only one or two pockets that [are] still under the control" of ISIS fighters, Abadi said, adding that their only option was to die or surrender.

Iraqi Prime Minister Haider al-Abadi, center, shakes hands with army officers upon his arrival in Mosul to declare victory over ISIS in the city on Sunday, July 9, 2017. Iraqi Prime Minister's Press Office / AFP - Getty Images

Abadi's spokesman told NBC News Sunday night that celebrations and a victory speech were postponed until the parts of Mosul where fighting is still ongoing have been recaptured.

ISIS militants had seized the city in June of 2014, as the terror group spread over swathes of Iraq and Syria.

Iraqi forces, aided by airstrikes from the U.S.-led coalition, have been battling to free the city for months and fighting had been concentrated in the streets of Mosul’s Old City in recent weeks.

Combat since Iraq launched its offensive to retake Mosul in October has left parts of the city in ruins, killed thousands and displaced nearly one million people, according to Reuters.

But while the battle against ISIS in the city was drawing to an end, the struggle for Iraq's future is far from over amid ethnic and sectarian fractures that have plagued the country for more than a decade.