But Prime Minister Nuri al-Maliki, standing next to Ban at a joint news conference, insisted that the Anbar unrest was not due to internal problems, and that dialogue with terrorist groups was not an option.
The UN chief's visit to Baghdad comes just months ahead of general elections, with the country suffering its worst spate of unrest since 2008 and militants holding an entire city and parts of another on Baghdad's doorstep.
"I would urge the leaders of the country ... to address the root causes of the problems," Ban said.
"They should ensure that there is nobody left behind. There should be political cohesion" and "social cohesion, and political dialogue, inclusive dialogue," he said.
"The security situation in Iraq is undoubtedly a source of great concern," said Ban, adding that he is "deeply concerned by this escalation of violence in Anbar governorate."
But Maliki insisted that "what is happening in Anbar has no relation to Iraqi problems" and ruled out dialogue with militant groups.
Events in the province have united Iraqis, he said, and therefore "today, there is nothing called dialogue."
"Dialogue with whom -- with Al-Qaeda? There is no dialogue with Al-Qaeda, and the Iraqi national decision is to end Al-Qaeda," Maliki said, referencing the role played by militant group of the Islamic State of Iraq and the Levant (ISIL) in nationwide violence.
Ban is on two-day visit to Iraq.
NJF/NJF