Comedian Mark Thomas found his idea of rambling along the Israeli barrier in the West Bank even more fraught than it sounds

The dubious honour of being the first person to walk the length of Israel's barrier in the West Bank, to the best of my knowledge, belongs to, well, me. Admittedly it's not a hotly contested title. Israel's massive barrier covered in watchtowers, wire and soldiers is hardly a hiking trail but it will become one eventually. That is the fate of military follies, from the Great Wall of China to Hadrian's Wall: they are destined to a future of tea shops and tour guides. I suppose I wanted to ramble this one before it goes mainstream and ends up covered with daytrippers wearing T-shirts saying: "Good girls go to heaven, bad girls go to Gaza."

There were other reasons for wanting to do the walk (primarily devilment and curiosity), but essentially I wanted to do for rambling what Hunter S Thompson did for journalism. Gonzo Rambling is what I was after (though without recourse to soaking the Kendal Mint Cake in acid) and where Thompson relied on drink and drugs for inspiration, I would rely on my natural talent for ineptitude.

The barrier, when completed, will career across about 723kms of land, winding in and out of the West Bank, moving from the fertile farmland of the Jordan Valley in the north-east, striking out west to the village of Zebuba then dropping down to Ramallah and East Jerusalem and on to the hills and crops south of Hebron.

I would be walking sections on both sides of the barrier. The area is heavily militarised and not a place to wander around in with your trousers stuffed into your socks clutching a copy of the Real Ale Pub Guide. In preparation, I met a host of people from Palestinian community leaders to media fixers to see if the walk was feasible. My favourite response came from an Israeli human rights lawyer who said: "There is nothing in law that stops you attempting your walk, but you should take my card."

On the first walk two Palestinians accompany me, Fadhi (a community organiser in the Jordan Valley and a debonair chap with corduroy jacket) and Jakob (a wiry farmer with a shock of grey hair whose trousers are held up with string). As we walk under a brilliant winter sky of clear blue along the fields of ploughed red-brown earth, we could be mistaken for a West Bank version of Last of the Summer Wine.

It soon becomes apparent that my desire to walk directly alongside the barrier is entirely impractical and possibly suicidal. The barrier is patrolled by the Israeli army 24 hours a day and within 10 minutes an armoured car arrives, stops alongside and blasts a loud squawking siren at us.

"We must move away from the wall," says Jakob, who fortunately speaks fluent siren.

A buffer zone exists on the Palestinian side of the barrier and the degree to which it varies in size, and the rigor with which it is enforced, depends on the mood of the soldiers. "You can not walk this near the fence, you must walk 300m away from it," says a soldier who detained me on the second walk.

"But that's ridiculous," I exclaim, pointing at the crops all around us. "That would mean that farmers can't work here."

"OK then," says the soldier, "150m."

I appear to have bartered over the buffer zone and haggled the soldier down.

On another occasion, as I walk next to the barrier, a soldier hears my accent and shouts, "You're from London! I used to live in Golders Green," then bellows, "ARSENAL!" as he waves us onward.

Mark Thomas with one of the border guards he met on his walk.

As I am detained for the third time in the first week it begins to dawn on me that rambling a military zone might prove problematic. More than that, the concept of my ramble does not cross the cultural divide easily: one Palestinian translator arrives for hiking in a blazer and slip-on shoes, another fails to turn up because it is raining. As for sleeping arrangements, there are barns, garages and people's floors, on which I lie exhausted, awake and wracked with doubt that I can complete the walk. This is Gonzo Rambling, and I have had enough of it.

In that first week I arrive in Jenin and on the edge of a narrow road decked with pictures of martyrs in bullet belts find the Freedom Theatre. A theatre in the refugee camp. The very concept would keep Richard Littlejohn in columns for a month, with japes of mime workshops for suicide bombers and relaxation classes for terrorists. But, bizarrely, he would have been uncommonly near the mark.

The theatre runs a drama course for young people in the refugee camp. They are far from standard Russell Group students. In a rehearsal studio students sit in quiet concentration, scribbling on large pieces of paper spread out across the floor.

"They are drawing their inner buffoon," explains the teacher. I smile and inwardly curse that "circus skills" have spread across this planet quicker than plague. But I chat to the students and a lad of about 18, quite unprompted, says: "You know, before I came here, one of my life options was to be a suicide bomber. To lay down your life for your community is an honour, right? But now I know art is my weapon."

It is the most extraordinary sentence I have heard. The room is full of stories like this. One student used to be a gang leader. One young woman had leaflets issued about her accusing her of being a slut for attending the theatre. Her family walked her through the camp to ensure she got to the drama course.

The charismatic theatre director is Juliano Mer-Khamis, half-Jewish and half-Palestinian, and a well-known Israeli actor. He cuts a dramatic figure and doesn't so much chat as proclaim. "The next intafada will be non-violent!" he declares when we sit to talk. "And here we are training the generation who will lead it. Palestinians who are critically engaged!"

As if to prove a point, the student's first show was an adaptation of George Orwell's Animal Farm. Such an obvious critique of the Palestinian National Authority saw Jenin's conservatives driven up the wall, and fortunately there was one nearby for them to do just that. But in the middle of a refugee camp, this theatre seems to show a possible future for Palestine.

"So why are you here?" says Juliano at the end of the visit.

"I am trying to walk the length of the barrier. Rambling." I begin my usual and now defensive attempt to explain my ramble. "It is an English approach to … " but before I can finish Juliano interrupts me. "We had the same idea! I wanted to do a film of walking the length of the wall." He calls out to one of the theatre staff, "He's walking the wall ... yes, filming it!" Turning, he shakes his head playfully: "Well, you did it first, so that's that idea gone. Where are you staying tonight?"

"I don't know yet."

"Stay here, we have a guest flat for visiting theatre companies, stay here for a few days."

Theatre director Juliano Mer-Khamis was shot dead in April 2011. Photograph: AFP/Getty Images

So at the height of my uncertainty about the walk, a flat above a theatre in a refugee camp became home. Each morning I would grab some tea with the students and set off. Each evening I would return covered in mud and Juliano would ask: "How did it go? A good day?"

Over the next few days, bolstered by having a base in a theatre environment and being surrounded by people who understood the walk, I managed to get my bearings.

The ramble went through the rural areas of Tura al-Gharbiya past the industrial city of Tulkarem and south through the countryside to Ramallah. And it lost none of the impromptu challenges. I still managed to fall off a mountain, find myself in the middle of a settlers' demonstration, get tear-gassed – which every visitor to the West Bank seems to go through, in fact it was a relief to get it over with as it would have been embarrassing to return home without that badge – and all of this as I crossed the most beautiful hills.

Would I recommend walking in the West Bank as a tourist activity? Cautiously, yes. There are a few travel guides – such as Green Olive Tours – who can organise walks with ex-Israeli soldiers and ex-Palestinian guerillas who offer real insight into the conflict and the barrier, and you get to walk through breathtaking scenery. It sounds obvious, but listen to the advice on offer from people in the area.

I wish I could urge you to visit Juliano in Jenin, but he was assassinated in front of the Freedom Theatre by a Palestinian gunman on 4 April.

• Green Olive Tours (+972 3721 9540, toursinenglish.com). The company also offers day trips round Jerusalem, Bethlehem and other historic settlements, multi-day trips throughout the West Bank and Israel and home stays with Palestinian and Bedouin families

For information about Mark Thomas's spring / summer tour see markthomasinfo.com