I had another life before I became a full-time writer. I was a criminal defense attorney for 10 years, working primarily in federal court. We handled all kind of cases, from white-collar crimes to murder and just about everything in between.

The question I got most often during my career in law—and am still asked today—was, “How can you defend all those guilty people?” This question always perplexed me. First of all, no one’s guilty at the outset, in a legal sense—not until the jury comes back with a verdict. And that might sound like a bunch of slick lawyer talk, but it’s a fundamental truth in this country: innocent until proven guilty.

But even more importantly, everyone is entitled to a legal defense. Everyone. Because if we start making exceptions for people we “know” are guilty, for the ones who commit the worst crimes, for the ones who aren’t sorry in the least, then where do those exceptions stop? It’s a slippery slope made all the more slippery by people who are sure they occupy the moral high ground.

I believe that working as a criminal defense attorney requires an embrace of moral complexity. Note that I didn’t say moral flexibility, which is something I think a lot of people wrongly assume about defense attorneys—that we have no idea where the moral lines are drawn. Rather, I view moral complexity as an ability to see beyond stark categories such as wrong and right, good and bad, friend or enemy—to see the world in all its hazy shades of gray.

That ability came easily to me and has ever since childhood. I was always the kid who couldn’t simply hate the bully without also wondering why he or she was acting that way, who was able to see both sides of almost every argument.

I can’t say for certain whether this tendency to play devil’s advocate was what led me to a career in law, but I do know that being a criminal defense attorney felt natural to me; the ability to see both sides of an argument felt like a gift rather than a liability. I never had any trouble sitting down across from those who might have done something horrible and just talking to them, listening to their story, seeing them as human.

Let me be very clear, here, though: none of this means I believe crimes should go unpunished or that consequences aren’t required. It simply means that I believe people are complicated, and someone who does a bad thing is not automatically unredeemable.

Eventually, I left the practice of law to stay home with my young children and fulfill my dream of writing a book. And it was no surprise to me that the moral complexity I encountered daily in my legal career wove its way into everything I wrote.

When writing The Roanoke Girls, I knew I wanted readers to feel some of the same conflict that the girls in the book do, to squirm a bit at their own feelings for certain characters. I recognize that it may make for uncomfortable reading, the idea of finding yourself charmed by people who have done awful things. But for me that was essential to the experience of the story. I believe it is entirely possible to recognize the humanity in others, to try to understand why they do what they do, to even feel some sense of pain for them, and still believe they have crossed a moral line that can never be uncrossed. For me, none of those ideas negates the others.

This can be a difficult, challenging way to navigate the world, and I recognize that it is not in everyone’s wheelhouse. It is, however, firmly in mine, and I find it impossible to separate myself from this mindset while writing. I’ve always found the why and who of someone more interesting than the what.

The what matters, don’t get me wrong. You can’t divorce a person from his or her actions. But you can also dig deeper. To do so doesn’t mean excusing what someone has done or giving them a free pass. It simply gives you a greater understanding. Too often I think people equate attempting to understand behavior with condoning it, and I vehemently disagree with that idea.

Working as a criminal defense attorney was often tedious and heartbreaking, and many times it felt depressingly futile as well. And while I don’t miss the work itself, I don’t regret having done it, either. The lessons I learned constantly influence me and my writing. Among other things, they gave me a broader understanding of human nature, of the wrongs we commit, and the glimmers of hope that can still be found in the darkest of places.

Amy Engel, a former criminal defense attorney, is the author of two YA novels. The Roanoke Girls (Crown, Mar.) is her first novel for adults.