It cuts a steel swath through the stark wilderness where Israel and Egypt meet, glinting in the desert sun as it snakes across barren hills and sandy plateaus. Wielding blowtorches at the base of the five-metre-high (16ft) barrier are some of the very men the border fence is in part designed to keep out: illegal immigrants from sub-Saharan Africa, now working as cheap construction labour for Israeli contractors.

Israel's newest frontier fence is being erected at high speed along the 150-mile boundary between the Sinai and Negev deserts. Its construction, due to be completed by the end of this year, was accelerated after last summer's cross-border attack in which eight Israelis were killed, and amid rising alarm about the number of refugees crossing into the Jewish state.

Once it is finished, Israel will be almost completely enclosed by steel, barbed wire and concrete, leaving only the southern border with Jordan between the Dead and Red Seas without a physical barrier. That, too, may be fenced in the future.

The government says fences along its actual and claimed borders are necessary as deterrents against terrorism and illegal infiltration. Regional upheavals over the past year – particularly in Egypt and Syria – have added to Israel's sense of being, in Defence Minister Ehud Barak's old phrase, a "villa in the jungle".

But in a scathing commentary in Yedioth Ahronoth, Israel's biggest-selling newspaper, respected defence analyst Alex Fishman recently wrote: "We have become a nation that imprisons itself behind fences, which huddles terrified behind defensive shields." It was, he said, a "national mental illness".

The latest stretch, along what the Israeli military calls the new "hot border" with Egypt, from the Red Sea almost to the Mediterranean, consists of latticed steel, topped and edged with razor wire, extending at least two metres below ground and in some sections reaching seven metres above ground. Ditches and observation posts with cameras and antennae will line the route.

An electronic pulse will run through the fence, setting off an alarm on contact that will allow the Israeli army to locate the exact spot of attempted infiltration. On the Israeli side, a sandy tracking path will show the footprints of interlopers, and an asphalt military patrol road will give unhindered access to army units.

Construction costs are expected to vastly exceed the 1.3bn-shekel (£224m) budget. Every day the steel snake advances roughly 500 metres, built by private subcontractors who hire labourers, some of whom have recently crossed the same border themselves. One Sudanese man working on the barrier recently had entered the country from the Sinai illegally after paying a fee to Bedouin smugglers.

The smuggling of immigrants was a major factor in the decision to build the fence. According to Lieutenant Colonel Yoav Tilan of the Israeli Defence Forces, 16,000 people – originating mainly from Eritrea and Sudan – crossed the border illegally in 2011 in "an industry of crime". But the "constant, daily threat" of terrorism and the smuggling of drugs are also important factors, he said.

About seven miles short of the Mediterranean, the southern barrier will meet the fence Israel has built around Gaza. It runs for 32 miles, with a buffer zone, which Palestinians are forbidden from entering, extending up to 1,000 metres inside the narrow Gaza Strip, swallowing prime agricultural land. The fence has kept Palestinians inside Gaza but has not stopped rockets being fired by militants into Israel, nor did it prevent the cross-border kidnap of IDF soldier Gilad Shalit in 2006.

At the northern end of the country, a fence built in the 1970s along the boundary with Lebanon was reconstructed, and in some places its route adjusted, after Israel withdrew its forces in 2000 following a 22-year occupation. It did not prevent the killing of five Israeli soldiers by Hezbollah militants in a cross-border ambush in 2006, nor the firing of thousands of rockets during the ensuing 34-day war.

Last month, Israel confirmed plans to replace the fence with a five-metre-high wall for half-a-mile stretch around the town of Metula, which is situated on a finger of Israeli territory and surrounded by Lebanon on three sides. Just a few hundred metres from Metula's supermarket, civilian traffic and UN armoured cars travel along a Lebanese road. According to Fishman, the new wall is intended to deter anti-tank missiles and sniper fire, but locals also speak of a flourishing drug-smuggling trade along this stretch of the border.

Further east, an Israeli fence sits on the ceasefire line drawn at the end of the 1973 Yom Kippur war, running between the Golan Heights, which Israel has occupied for almost 45 years, and Syria. Hundreds of pro-Palestinian demonstrators breached the fence last May, in the Golan and along the Lebanese border. Around a dozen people were killed and scores injured when the IDF opened fire.

A crossing at Quneitra, operated by the UN, allows the movement of UN personnel, truckloads of apples, a few Druze students and the occasional Syrian bride in white. Damascus is an hour's drive away. A few miles north of Quneitra is Shouting Hill, where Druze families in the Golan yell greetings across the barrier to relatives in Syria.

Moving south through heavily mined fields and hills, the ceasefire line is dotted with Israeli military bases and zones, and carcasses of tanks from past battles, until it meets the border with Jordan. Soon it joins up with Israel's first fence, constructed in the late 1960s, which now stretches almost from the Sea of Galilee down the fertile Jordan Valley to the Dead Sea. Most of this line is not Israel's border, but the boundary separating Jordan from the Israeli-occupied West Bank.

Around a third of the way down this stretch, the fence abuts the infamous huge steel-and-concrete West Bank barrier. This runs along or inside the 1949 armistice line, or Green Line, swallowing up tracts of Palestinian agricultural land, slicing through communities and separating farmers from their fields and olive trees. Israel says the barrier is a security measure that has deterred suicide bombers, but many believe it marks the boundaries of a future Palestinian state, taking around 12% of the West Bank on to the Israeli side. About two-thirds of its 465-mile length is complete, mostly as a steel fence with wide exclusion zones on either side.

Around 10%, mainly in urban areas, is a bleak, imposing eight-metre-high concrete wall. The international court of justice ruled the barrier illegal under international law in 2004.

Israel's only open border, through the Arava desert from the Dead Sea to the Red Sea resort of Eilat, may be fenced in the future, according to Fishman.

"The moment the border with Egypt is sealed off, the drug dealers, human traffickers and terrorists will take a longer route, go through Sinai into Jordan, and from there infiltrate Israel. The defence ministry and the IDF are already planning to... erect a fence in the Arava too, along the border with Jordan," he wrote. Then Israel "will have finished our disengagement from the Middle East".

Israel is not alone in erecting barriers: fences exist or are being built or are planned along other countries' borders, mostly to counter illegal immigration and drug smuggling. But even the most heavily militarised borders fail to completely stop terrorism, smuggling and people determined to reach a better life.

Back at the Israel-Egypt boundary, the IDF last month reopened a stretch of Route 12 that had been closed to civilian traffic since the cross-border attack seven months ago. The new fence was the main factor in allowing motorists back on the road, which runs along the country's southern perimeter.

But, the IDF admits, the barrier is not infallible. In the expectation that smugglers and militants will dig tunnels, cut steel and seek alternative routes, the fence is reinforced with armed patrols, surveillance, intelligence-gathering and trackers.

According to Fishman, all this is symptomatic of the Israeli psyche. Every fence and wall, he told the Guardian, was built for a valid reason. "Every decision was the right decision for its moment. But it's like pieces of a puzzle – you don't know what will be the picture at the end, but then when you see the whole picture, it shocks you.

"We have become a nation that is burying itself behind walls, behind fences. It shows we are going much more towards isolation. Mine is a very patriotic standpoint – and my disappointment comes from this patriotic standpoint. A fence is a kind of weakness. I'm not a psychiatrist but it shows something of the mentality of a nation."