Many of Franz Kafka’s characters have vexing relationships with paperwork. There’s Poseidon, god of the sea, who’s stuck overseeing the budget for the ocean, and then there’s K., whose life revolves around missing files. So it’s fitting that in death, Kafka’s own physical papers have become an exemplar of the legal confusion and bureaucratic absurdity his stories were famous for.

Kafka, who died in 1924, left his manuscripts to his friend Max Brod, and told him to burn his unpublished works. But in a quintessentially Kafkaesque turn of events, the Israeli supreme court ruled on Monday, Aug. 8, that they now belong to the country’s national library.

That may seem odd, given that Kafka is an icon of his native Prague, and didn’t live in Israel.

The labyrinth of changed hands goes like this: Brod, who didn’t heed his friend’s request, published many of Kafka’s works posthumously, including The Trial and The Castle. According to the Guardian, Brod took the documents with him when he fled to Palestine in 1939, and left them to Esther Hoffe, his secretary. She in turn was instructed to give them to the “Hebrew University of Jerusalem, the municipal library in Tel Aviv or another organization in Israel or abroad” after Brod died, which happened in 1968.

But, surprise, she didn’t. Hoffe left Kafka’s unpublished letters and writings to her two daughters, and after she died in 2007, they went to court with the state over the papers. In 2012 a court ruled that the two women had to give them up, and last year a district court held up the decision.

At long last the real-life Kafka trial has come to an end with Monday’s decision that Hoffe’s surviving daughter must hand over the documents to the National Library of Israel.