Thousands of Shiite militiamen and supporters rallied on Saturday and demanded that Turkish troops immediately withdraw from Iraqi territory, a show of strength by the country’s powerful militias and the Shiite political rivals of Prime Minister Haider al-Abadi.

Militiamen in fatigues, and their supporters and onlookers gathered in Baghdad’s Tahrir Square, chanting, “No to occupation! No to Turkey!” Some young men burned Turkish flags. Former prime minister Nouri al-Maliki, who is Abadi’s fiercest rival, walked through the square and was mobbed by supporters who took photos and videos with their phones.

Turkey has had troops near the Islamic State-held city of Mosul in northern Iraq since last year, but the arrival of additional troops last week has sparked an uproar in the country. Ankara subsequently halted further deployments.

Hadi al-Amiri, the leader of the powerful Badr Brigades, a Shiite militia, called for the troops to leave, drawing cheers and chants.

“This is a clear message that the Iraqi politicians and the people of Iraq are against this intrusion into the sovereignty of Iraq,” said Saad al-Muttalibi, an Iraqi lawmaker and close Maliki ally.

He said, however, that the demonstration was not meant to be a challenge to Abadi’s handling of the crisis. “We support the processes, but we think the people will be heard in such important events,” he said.

Hussein Ali, 40, a Baghdad businessman, said troops cannot enter another country without the agreement of its government.

“Even if they had the agreement of the Kurdish [regional government], that doesn’t count. It’s a violation,” he said.

The Kurdistan Regional Government denies brokering a deal with Turkish troops to increase their presence at a base near Mosul, insisting that Baghdad approved the training mission months ago.

Harith Hasan al-Qarawee, an Iraq researcher at Brandeis University, said the protest Saturday was as much about Baghdad politics as it was about tensions with Turkey.

“For Maliki and his allies in the Shia paramilitary groups, this was an opportunity to consolidate their Shia constituency,” he said. It was also a chance to show that Abadi and his allies “cannot match their powerful reaction to the Turkish intervention.”

“Iraq is the ‘sick man’ of the region,” Qarawee said. Internal divisions are not only hampering the country’s fight against the Islamic State group, but they are also encouraging other powers to bypass the central government, he said.

Turkish President Recep Tayyip Erdogan repeated Friday that Turkey would not withdraw troops already in Iraq and said that the training process taking place “in agreement” with Iraq would continue.

Ali said he came to Tahrir Square over the summer to protest government corruption but stopped attending when it became clear nothing was changing