BAGHDAD — When American forces raided a home near Falluja during the turbulent 2004 offensive against the Iraqi Sunni insurgency, they got the hard-core militants they had been looking for. They also picked up an apparent hanger-on, an Iraqi man in his early 30s whom they knew nothing about.

The Americans duly registered his name as they processed him and the others at the Camp Bucca detention center: Ibrahim Awad Ibrahim al-Badry.

That once-peripheral figure has become known to the world now as Abu Bakr al-Baghdadi, the self-appointed caliph of the Islamic State in Iraq and Syria and the architect of its violent campaign to redraw the map of the Middle East.

“He was a street thug when we picked him up in 2004,” said a Pentagon official who spoke on the condition of anonymity to discuss intelligence matters. “It’s hard to imagine we could have had a crystal ball then that would tell us he’d become head of ISIS.”