Five months ago, a Kurdish intelligence "asset" walked into a base and said he had information to hand over.
The capture by jihadists the month before of two Sunni cities in western Iraq was just the beginning, he said. There would soon be a major onslaught on Sunni territories.
The Islamic State of Iraq and the Levant (ISIL), a renegade offshoot of al-Qaida, was about to take its wellknown co-operation with leftovers of the regime of Saddam Hussein, and his former deputy Izzat al-Douri, to a new level.
His handlers knew their source had always proved reliable, officials said, so they listened carefully as he said a formal alliance was about to be signed that would lead to the takeover of Mosul, Iraq's second largest city.
Parts of the city were already a no-go zone because of the terrorist presence. ISIL was partly funded by extorting a tax from local businesses. But the group was too small to carry out its plans on its own. These involved an ambitious sweep through northern Iraq, to take on Baghdad itself.
For the ex-Baathists, it was a chance to get revenge on the country's new, Shiite-led leadership, much of which had spent years in exile during the Saddam years. The Baathists are also Sunni and resented their loss of power to the Shiite majority.
"We had this information then, and we passed it on to your (British) government and the U.S. government," Rooz Bahjat, a senior lieutenant to Lahur Talabani, head of Kurdish intelligence, said. "We knew exactly what strategy they were going to use, we knew the military planners. It fell on deaf ears."
The extremist insurgency has been growing ever since the United States pulled out its troops, the last Americans leaving in December 2011. In December last year ISIL took over Fallujah and Ramadi, two cities in the largely Sunni Anbar province, which was a hotbed of the al-Qaida-led uprising against the western occupation of Iraq.
The insurgency has been fostered partly by resentment among Sunni Arabs at the Shiite-led government of Nouri al-Maliki, which they say discriminates against them and whose armed forces and militias they accuse of harassment, torture and murder. It has also been fed by recruits to ISIL's other war, in Syria.
Bahjat estimated that there were now 4,000 foreign fighters with ISIL. He warned that Abu Bakr al-Baghdadi, the ISIL leader, was now a greater threat to western countries than Osama bin Laden had been in 2001.
"The sleep of reason produces monsters. It's the lack of resolve in the West that is the most important thing," said Lahur Talabani, head of Kurdish intelligence, and Bahjat's superior.
"Both the Americans and the British had options to upgrade their presence on the ground many months before this happened but seem not to have acted on that," said Michael Stephens, an analyst with the Royal United Services Institute, a British think-tank.