Israel’s separation barrier in the West Bank village of Al-Ram. Photograph: Ahmad Gharabli/AFP/Getty Images

No matter how many photographs you have seen, coming face to face with the wall in the West Bank is a shock. We often use the word "concrete" as an antonym for "imaginary", but when I first touched this eight-metre-high edifice of concrete, alongside what would otherwise have been a quite ordinary street, my first reaction was disbelief. How had this been thought of, let alone built? Up close, this wall seemed both real and implausible.

Everyone has heard of the Berlin Wall. The wall in the West Bank, despite being twice as high and four times as long, is not such a familiar structure. It is the biggest civil engineering project in the history of Israel, so far costing more than $2.6bn (£1.7bn), but many of us don't even know what it looks like. Perhaps the most extraordinary facet of this unique construction, built on land at the very nexus of the bitterest land dispute of modern times, is that it appears to have swathed itself in a cloak of current affairs invisibility.

As a novelist, and a diaspora Jew disturbed by Israel's ever-increasing military belligerence, the more the world ignored this wall, the more interested in it I became. During the 10 years of its construction, as this part-wall, part-fence spread across the West Bank, tracing a perplexingly circuitous route, I slowly became convinced that this edifice was more than just a wall. It was a symbol of something. But to discover exactly what, I had to start writing.

I developed an idea about a boy in an unnamed, non-specific place, a comfortable suburb, who has never questioned the impenetrable wall adjacent to his home, or his parents' stories about the "enemy" on the other side. His discovery of a tunnel, and the growth of his teenage inquisitiveness, lead him to unearth some painful truths. I finished a rough draft, only to discover that the story worked, but that the setting was too vague. Was this, or was it not, a novel about the West Bank? I realised that I needed to visit the wall that had initially sparked my interest and make a decision about how specific I wanted my novel to be. A chance conversation alerted me to the fact that the Palestine Festival of Literature, or Palfest as it is usually known, was coming up. I wrote to the organisers and, to my delight, they made space for me.

I felt well-versed in the subject, well‑read on the political situation, but nothing had prepared me for the devastating reality of visiting the West Bank. Since it is extremely difficult for Palestinians to travel freely around the occupied territories, Palfest has to travel to its audience rather than the other way round. It resembles a roadshow rather than any other literary festival, delivering to Nablus, Jenin, Ramallah, East Jerusalem, Bethlehem and Hebron an international group of writers for an intense series of workshops, seminars, readings and discussions with local writers.

The festival has a dual purpose, serving as much to entertain its audience as to educate the writers who participate. It is in the travel between events, coming up against the effects of military occupation on ordinary civilian life, that this education takes its most shocking form.

We crossed the wall twice at Qalandia checkpoint, as 23,000 Palestinians are obliged to do every day. This checkpoint has turned what was once a simple 20-minute drive from Ramallah to East Jerusalem into a complex ordeal. Physically going through this checkpoint, walking through the claustrophobic metal cages, awaiting the release of a remotely operated turnstile that allows through one person at a time, surrounded by crowds of impatient but stoical Palestinians trying to get to work, scrutinised from above by armed soldiers on raised gantries, was a visceral experience.

The phrase "military occupation" trips off the tongue easily. Only in close proximity to the invading army do you begin to get any inkling of what it must feel like to live your life at the mercy of hostile foreign troops. In a lifetime of movie-watching I have seen thousands of weapons, but at Qalandia checkpoint I felt, for the first time, the power of the gun.

In the long queue I found myself adjacent to a doctor who had qualified in Germany and now worked in Jerusalem, but who had been refused a Jerusalem residence permit by the Israeli authorities on return from her training. She, therefore, had to live away from her family, in Ramallah, and endure this checkpoint twice a day. "I could work in Europe and live a normal life," she told me. "But that is what they want. For people like me to leave." This, she implied, was the real purpose of the wall. It was her duty not to be forced out.

I returned from Palestine psychologically and emotionally devastated by what I had seen. Every aspect of the occupation was harsher, more brutal than I had expected. For months, I couldn't even look at the draft of my novel. The idea of treating this topic too lightly, of not doing justice to the suffering I had witnessed, filled me with shame. I knew I had to make the next draft of the book resemble the West Bank more closely, but I also knew it had to retain some distance from reality for the novel to function as fiction.

Eventually, I reread the work I had done, then set about picking it apart and rebuilding it in a modified world. I have ended up with a novel, The Wall, which is still set in a place that is, and isn't, the West Bank. The novel's setting is in some ways imaginary, but is also deeply researched. Anyone interested in this military occupation will, I hope, find some insights into the reality of how it operates. But I have only succeeded as a writer of fiction if this is a story that engages people who know nothing about Israel and Palestine, but are curious about a more universal topic: the division between the haves and the have-nots, and the invisibility of the latter in the eyes of the former. The wall in the West Bank may be unique, but what it represents has echoes everywhere.