It’s almost a cliché that spy novels should be dark, gripping, ambiguous. Espionage, after all, is the shadowy business of stealing high-stakes secrets, of manipulation, deception, and betrayal. But after six years of spying for the CIA—then writing my first spy novel—I found the profession was defined by something more fundamental: the enduring weight of unanswered questions.

When I arrived in Baghdad as a first-tour case officer in November 2004, Iraq had the grim distinction of being the most dangerous place on Earth. More than 800 American soldiers had been killed at that point. Ambushes against U.S. military convoys were fouling up roads; mortar shells and rockets rained down daily on the Green Zone. Abu Musab al-Zarqawi, the ruthless leader of al-Qaeda in Iraq (AQIZ), was ploughing a rapid course of destruction, responsible for more bombings, beheadings, and attacks than the world could count. My job was to find and recruit informants who could help dismantle al-Zarqawi’s network.

The violence in Baghdad was staggering. We wore armor and carried weapons; we spent most of our time hunkered down in the Green Zone, making harrowing, fleeting trips into the Red Zone in heavily fortified vehicles to pick up sources. Some nights I slept in the CIA station, which was safer than my trailer. I celebrated New Year’s in a bunker, waiting out a rocket attack.

A few months into my tour, I learned that one of my informants was remotely connected to an alleged AQIZ-affiliated terrorist. We’ll call him Qasim. He was one of the military’s most wanted targets, suspected of participating in the 2003 bombing of the UN headquarters in Baghdad. Miraculously, my informant helped track Qasim down. In a seemingly unwinnable war, this felt like a huge victory.

We brought Qasim in for questioning. He admitted nothing—but we expected this. Detainees often stonewalled, sometimes reciting “72 hours” (the length of time they could be held without evidence). When dawn crept under the door, the military cuffed Qasim’s shaking hands and transported him by helo to a detention facility. The truth, I felt confident, would come out eventually.

My tour ended, and I returned to D.C., bringing back infinite particles of dust, tailspins of panic from loud noises, and a compulsion to escape traffic jams. A colleague at Langley, I learned, had questioned Qasim at a different detention facility. He was still incarcerated, still hadn’t cracked. People were starting to doubt his guilt. Or maybe it was just me.

Espionage, I’ve come to realize, isn’t just about ambiguity or divining unknowns. It’s about what you’ll never know—and making peace with the unanswered questions.

Years passed, and my uncertainty grew. I replayed Baghdad in my mind like an unfinished sentence. Some days, I wondered whether we’d gotten it wrong. The “war on terror” was messy, imprecise. Mistakes were certainly possible: people were operating under difficult, shifting conditions, erring on the side of our national security. I didn’t blame anyone—but the irresolution plagued me. I’d escaped to a quiet place, to paraphrase Graham Greene, only to find silence shouting in my ear.

When I returned to the Middle East in 2012—this time to Manama, Bahrain—a different conflict was brewing: the Arab Spring. Bahrain’s Shiite majority, rumored to be backed by Iran, was revolting against the Saudi-backed Sunni monarchy. It was a new Cold War. The U.S., whose Fifth Fleet is headquartered in Bahrain, was caught in the middle, torn between its own security needs, supporting democratic reforms, and fending off Iranian aggression in the Persian Gulf. A landscape, like Iraq, blurred by dust, where right and wrong are thickly knotted, truth a moving target.

My novel, The Peacock and the Sparrow, is based on these unresolved worlds. Espionage, I’ve come to realize, isn’t just about ambiguity or divining unknowns. It’s about what you’ll never know—and making peace with the unanswered questions.

In The Peacock and the Sparrow, an aging spy, Shane Collins, is caught in the crosswinds of the Arab Spring, forced to choose sides. He becomes ensnared in murder, consuming love, and an unpredictable revolution. Looking back, he’s haunted by his decisions—how they’ve affected lives, “the tangle of mistakes, promises, and defeats that grips a man’s heels.” There are things, he finds, that won’t let him go. Spying is a “profession of ghosts,” Collins concludes, “the culmination of actions taken or not taken, ends swallowed by means.”

Though my book is fiction, the detritus and viscera of my experiences are on every page—in metaphors, semblances, amalgams, all the wonderful devices through which literature allows us to make sense of the world, and, at least for me, confront a few ghosts.

I.S. Berry spent six years as an operations officer for the CIA, serving in wartime Baghdad and elsewhere. The Peacock and The Sparrow (Atria, May) is her debut novel.