At the same time I was acutely aware that this quick in-and-out, within the bubble of the physical security the American military was providing for the senators, was nothing compared with the sustained risks taken by my colleagues who routinely go into war zones without such protection to tell the world what is happening there.

Some Pentagon officials had not been thrilled about having a reporter along for a congressional trip that was already a big responsibility. Even as I was boarding the plane to the Middle East, Senator Graham later told me, the military bureaucracy had tried to avoid taking me to a prison site by abruptly saying there would be room in a planned convoy for each lawmaker to take just one aide. Only after he declared that his second spot would go to me, the senator said, had they grudgingly added more vehicles.

As we were heading to the first prison, a military official told me I would not be permitted to take any photographs inside its walls. I leaned on my Guantánamo experience to appeal to Lt. Gen. Paul E. Funk II, the commander of the coalition forces fighting in Iraq and Syria, who was accompanying the delegation. I explained to him that at Guantánamo the military permits journalists to take photographs inside the prison so long as detainees’ faces are not visible, and he agreed to switch to “Guantánamo rules.”

As it turned out, there was no way to take any shots of the ISIS detainees from our vantage point outside a cell that would not show their faces. But being able to take other pictures inside the compounds was helpful for remembering details, and a few were decent enough that The Times published them — one on the front page. As colleagues ribbed me about my photojournalism skills, I jokingly vowed never to write again.