One of the most common forms — most humans being nonmagical themselves — is the power that comes from striking a bargain with a magical being. This is where a properly vetted contract is particularly important. Spirits and demons tend to have good legal minds, and while they will usually abide by the terms of an agreement, at the time of signing they are under no obligation to point out provisions that might be unfavorable to the other party. Dr. Faustus might have avoided a lot of trouble if he’d had a lawyer go over his contract with Mephistopheles, explaining carefully the consequences of each clause.

Other writers, like C. S. Lewis, have located the source of magic in a more spiritual dimension. But even in Narnia, magic works according to laws. Facing off against Aslan, the White Witch cites Deep Magic to make her case: “Unless I have blood as the Law says, all Narnia will be overturned.” But what the witch hasn’t counted on is that Aslan knows magic — the law — better than she does. She doesn’t anticipate his return from the dead. “Her knowledge goes back only to the dawn of time,” he says. “If she could have looked a little further back ... she would have read there a different incantation.” With better counsel, the witch might have come up with a more effective strategy.

There’s also the magic that’s innate in some lucky humans, of whom J. K. Rowling’s Harry Potter is probably the most famous example. Most of the laws involving magic in his world seem to be various restrictions on its use. (As an underage wizard, Harry gets into trouble for working spells outside of Hogwarts, for instance.)

Legal proceedings crop up several times in Ms. Rowling’s books, and they aren’t very different from the ones in our world. You have the sense that an experienced Muggle barrister, properly briefed, could hold up his end of a trial in that dungeon courtroom in the Ministry of Magic. (And perhaps it’s no surprise that Ms. Rowling has now written a crime novel starring a distinctly un-magical detective.)

In fact, Ms. Rowling never quite explains what magic is, although it clearly takes both inborn ability and a lot of study and practice. It’s noteworthy, however, that the final battle between Harry and his nemesis, Voldemort, turns on what’s essentially a question of title: Who is the rightful owner of the Elder Wand? The answer isn’t obvious, but Harry’s rather legalistic explanation carries the day. “ ‘So it all comes down to this, doesn’t it?’ whispered Harry. ‘Does the wand in your hand know its last master was Disarmed? Because if it does ... I am the true master of the Elder Wand.’ ” Voldemort may not be convinced, but the Elder Wand flies to Harry’s hand.