Turkish writer Elif Shafak does everything but pull a genie out of a lamp to evoke the “Thousand and One Nights” in her new novel set in the 16th century.

Only in this case, the princess is the one listening to the tales.

The storyteller is an Indian orphan-turned-stowaway-turned-imposter in the court of Sultan Suleiman. While he is adept at lying, Jahan may not quite be the talespinner Scheherezade was – or at least not as much a master of the cliffhanger. When he reaches the end of his tale, the princess tells him he should have made his stories longer, so she could have come back for 1,001 days to hear them.

The Architect’s Apprentice, Shafak’s 10th novel, is a consciously old-fashioned story, recalling folk tales to leisurely recreate Istanbul during the height of the Ottoman Empire. From the orphaned hero who has to rely on his wits to the beautiful princess and animal sidekick, Shafak does everything but open with “Once upon a time.”

Arriving at court at the age of 12 after escaping his abusive stepfather, Jahan manages to finagle his way into two careers: mahout to his best friend, a rare white elephant named Chota, and apprentice to Mimar Sinan, Chief Royal Architect to three sultans. The real Sinan created masterpieces such as the Suleymaniye Mosque and Selimiye Mosque, which are still standing today.

“Istanbul is a city of easy forgettings. Things are written in water over there, except the works of my master, which are written in stone,” Jahan says.

Jahan has a third, more dangerous, occupation: He has been smuggled into the court by an unscrupulous sea captain, who wants the boy to steal anything he can gets his hands on – or else he will expose him as a fraud. Jahan and Chota are drafted into battle, where the two come to the attention of Sinan. Sinan, a man who regards architecture as a “conversation with God,” has a habit of collecting talented strays and he takes on Jahan as his fourth apprentice.

“There were six of us: the master, the apprentices and the white elephant. We built everything together. Mosques, bridges, madrasas, caravanserais, alms houses, aqueducts,” Jahan writes in a foreword. “I remember the promises we made, and then failed to keep, every single one of them. It’s odd how faces, solid and visible as they are, evaporate, while words, made of breath, stay.”

After several near-brushes with disaster brought on by curiosity and the fact that the fake mahout can’t really teach Chota any tricks, Jahan also learns to navigate the palace, where “it was lonely enough to make you love your own shadow and crowded enough to leave you gasping for air.” He also falls in love with the teenage Princess Mihrimah, who comes to visit the rare white elephant. (This not being a Disney cartoon, the romance is almost entirely one-sided.)

As Shafak sets the foundation of her plot, it becomes apparent that Jahan isn’t the only apprentice hiding secrets about his past. All four vie for the attention of their master. Sinan’s work is so excellent that he deliberately includes a flaw in every building so as not to overstep, since perfection belongs only to God. But court politics, the vagaries of whims of the sultans he serves, and a series of accidents blamed on the supernatural threaten his and his apprentices’ careers – if not their lives.

He’s a benevolent master, spending as much time on character as math and draftsmanship. Sinan tells Jahan “resentment is a cage,” and at one point, refuses to let the apprentices see one another’s designs, “because you’ll compare. If you think you are better than the others, you’ll be poisoned by hubris. If you think another’s better, poisoned by envy. Either way, it is poison.”

Sinan is the anti-Howard Roark, the architect in “The Fountainhead” who dynamites his own building rather than have the design compromised.

While Sinan's desire to believe the best about everyone causes its own heartache, it's easy to see why Jahan adored a man who could face the court-ordered razing of his work without bitterness. “I cannot prevent people from destroying,” Sinan tells him. “All I can do is keep building.”

“The Architect’s Apprentice” is lengthened by a couple of subplots with varying degrees of success, including a trip to Rome that primarily serves to allow Shafak to work in a cameo by Michelangelo. And while decades pass during the story, Jahan remains perpetually boyish – a state of suspended emotional development that can surprise a reader when Shafak talks about gray hair and wrinkles.

But for those who want to read the way they did when they were young, “The Architect’s Apprentice” offers an adventure story complete with battles, kings, sea voyages, prisons, disguises, artists, a curse, betrayal, and a Romany king who has a knack for showing up just when he is most needed.

He travels in a horse-drawn caravan, rather than a brass lamp, but Balaban has an almost magical way of clearing away problems for Jahan. Best of all, he isn't limited to three wishes.