“I wanted to write a novel that paid attention to history; I wasn’t entirely certain what that meant.”

After my first novel came out, I sent copies of the book to a half dozen or so mentors who had helped me along the way. All of them wrote back saying how proud they were. All except for one, a distinguished professor of Middle Eastern history whose seminar had been my first introduction to the Ottoman Empire.

It wasn’t that he didn’t like the book, he said, but that certain parts of the novel didn’t “pay so much attention to well-established basic information.” His critique stung, but I wasn’t especially surprised. While writing the book, I had been somewhat cavalier with the historical record. I had moved around a few palaces, made up an international incident or two. And most significantly—for my professor—I had transformed the authoritarian sultan Abdul Hamid II into a bumbling dilettante.

I had my rationalizations for the tweaks. I was playing with history, I told myself, creating a new world. I was working within a long literary tradition, building on authors such as Calvino, Rushdie, Márquez, and Grass. I had sprinkled little winks and nods throughout the book, alerting the reader to my historical infidelities. And anyway, this was fiction, not history.

I held on to these justifications but eventually realized my professor was right. As someone who had lived under an authoritarian regime himself and had been thrown in jail for what he wrote about the past, my professor understood that history isn’t something to be screwed with. He wasn’t saying that all novels needed to be 100% historically accurate. He just wanted me to pay attention, to recognize the power of stories. Because, regardless of my intentions, and my winks and nods, my version of Abdul Hamid II would be, for most readers, the only one there was.

My professor’s email was at the front of my mind when I started writing my second book, a multigenerational novel centered on a 1,000-year-old synagogue in Cairo. I wanted to write a novel that paid attention to history; I wasn’t entirely certain what that meant, but I was pretty sure the first step was to read everything I could find about the history of Cairo and its Jewish community.

I spent a month on the bottom floor of UC–Berkeley’s main library reading through books that hadn’t been checked out in decades. I took careful notes on oversize index cards. Eventually, I set the cards aside and started writing.

It was then—in the messy process of imagining characters and conflicts, in building out the world and bringing it to life—that the inaccuracies began to seep in. I did my best to pay attention. And the final product is very much true to the historical record. But I would be lying if I said that I checked every fact. There were times I couldn’t find something I was pretty sure I remembered, times I was too lazy to look up a small detail. And then there were a few times when the dictates of fiction overruled history.

At the heart of the novel, for example, is a Muslim family who, for hundreds of years, served as watchmen of the Ibn Ezra Synagogue. It’s a nice image and serves as the through line connecting various the parts of the book. The trouble is, there’s no indication that such a family ever existed. The idea came to me from a woman I met on a plane, whose family had served as watchmen for a synagogue in Kolkata.

Upon further research, I learned about other Muslim families who had watched over other synagogues in the Middle East and North Africa. But I wasn’t able to find evidence of such a family in Cairo. Even so, I kept them in.

I agree with my professor. A novelist should pay close attention to history, especially in our current historical moment. But novels are not history books; they are works of imagination, containing thousands of tiny details—the accumulation of which is a truth much broader than what makes it into history books.

Michael David Lukas’s next novel, The Last Watchman of Old Cairo, will be published by Spiegel Grau in March.