NABLUS, West Bank— Mahmoud Kilani first tasted life in Israel when he sneaked through a hole in the wall confining Palestinians in the West Bank so he could meet a young woman he encountered online.

Soon, the 22-year-old Palestinian skateboarding enthusiast had an Israeli work permit and spent months in the Mediterranean city of Haifa, working in bars and restaurants, learning Hebrew and making Israeli friends.

Before then, the only Israelis he ever encountered were soldiers or settlers in tense interactions around his home city of Nablus. “The concept of having Israeli friends—there was none of that in Nablus,” he said.

Then, Hamas attacked Israel on Oct. 7. Israel responded with a massive military campaign in Gaza and swiftly expelled Palestinian workers . The holes in the wall were sealed. Tight Israeli military control of West Bank roads has kept Kilani effectively confined to his crammed hometown.

Gen Z Palestinians have always grown up with little hope for the future, coming of age after a Palestinian uprising known as the Second Intifada resulted in Israel’s erecting a barrier across much of the military-occupied West Bank. In the Gaza Strip, the rise of Hamas, the Islamist group designated as a terrorist organization by the U.S., led Israel and Egypt to impose a blockade on the enclave in 2007.

Though their parents recall an era of hope amid the 1990s Oslo Accords, the last breakthrough agreement between the two sides, Palestinians under the age of 25—who comprise most of the population—say the door to coexistence with Israelis always felt barely ajar.

It has been slammed shut since Oct. 7.

Kilani now falls asleep to the din of gunfire during routine Israeli military incursions in his hometown, some of which have killed his loved ones and inspired some of his friends to become militants.

“I try to talk them out of it, but I can’t,” Kilani said. “They say that they see no other way—that regardless, people where they live will be killed, so they might as well make it harder for the Israeli army.”

As the U.S. and some Arab nations try to persuade Israel to work toward resolving its conflicts with Palestinians for good, young Palestinians increasingly say they don’t see an independent state as viable given Israel’s deep footprint in the West Bank and Gaza. Their pessimism, coupled with a flatlining peace process, makes it less likely a two-state solution will be achieved. It could also force Palestinian, Israeli and international leaders to return to the drawing board.

Palestinians under 25 are less optimistic about the future than their elders, according to polling from the West Bank-based Palestinian Center for Policy and Survey Research. They are also more supportive of using violence to fight for democratic rights than their parents and grandparents, a symptom of the past’s failed diplomacy, said Khalil Shikaki , the center’s director.

“The youth see their struggle as akin to that of people who lived under apartheid in South Africa,” Shikaki said. “They feel they have to force Israel’s hand to dismantle its system of occupation.”

Distrust on both sides

Israelis have also grown more skeptical of the chances for peaceful coexistence. That skepticism grew during the Second Intifada, when Palestinian militants launched suicide bombings across Israel, and deepened after Oct. 7, leading many Israelis to conclude they could never trust Palestinians.

About 79% of Jewish Israelis said in a May survey that they don’t support the establishment of Palestinian state, according to the Jerusalem Center for Public Affairs, an Israeli think tank. Before Oct. 7, 69% of the survey’s respondents said they didn’t support a Palestinian state.

For young Palestinians, the latest Israel-Hamas war is at least the fourth period of intense, sustained conflict they have endured, including two other major air campaigns that Israel says targeted Hamas in 2008 and 2014 in addition to the Second Intifada.

Young Palestinians in Gaza and the West Bank have never known life without restrictions on their movement, which include not only walls but also military checkpoints and a complicated permit regime that determines where Palestinians can go. Many young Palestinians have never left their home territory.

Some say that they or their friends and relatives have been humiliated, beaten or killed by Israeli soldiers and settlers.

Israeli authorities have said they seek to discipline soldiers who violate military policy, as well as settlers who attack Palestinians, and that military operations in the West Bank and Gaza and restrictions on Palestinian movement are needed to address threats to its security.

Lost childhoods

Many young Palestinians have had to confront life-or-death responsibilities from a young age, hardening their views.

In the Gaza Strip, 15-year-old Layan Harouda had to tend to her younger siblings when airstrikes pounded her hometown of Gaza City late last year. She helped pitch the tent that became their temporary home after her family was displaced, trying hard to keep her siblings’ spirits up.

“I joked with them that the tent was built so well, they should give it an 8/10 review on a travel site,” she said.

But staying hopeful was hard. “I have lived through things no one ever should,” she said.

When Layan’s mother, a journalist, received word late last year that the family could leave the besieged enclave through her work connections, her mother wanted to stay to document the war. Layan persuaded her to evacuate the family.

After leaving Gaza in November, Layan lives in Qatar. She says she is filled with shame having access to clean water, a bed and education, while her friends in Gaza live in tents, under drones and airstrikes. She longs to return to Gaza, but with her home obliterated, she questions the viability of that aim.

“I wonder: Will I ever see my friends again? Will I ever see Gaza again?” she said. “You can try to run away from reality, but you never can.”

Elusive peace

Many Israelis and Palestinians viewed the 1990s as a period of progress toward lasting peace. The leaders of the two sides reached across the aisle, crafting the Oslo Accords, which, among other things, allowed Palestinians to establish the semiautonomous Palestinian Authority and hold their own elections—widely viewed as steps toward Palestinian statehood.

“At the time, Palestinians wanted to believe that Israel wanted to end the occupation, and if not, that the West would pressure Israel to allow for the establishment of a Palestinian state,” said Mouin Rabbani , a nonresident fellow at the Center for Conflict and Humanitarian Studies, an independent research center based in Qatar. “Part of the disappointment and dissolution that followed is a function of the exaggerated hopes that initially existed.”

Elements of the accords quickly fell apart, and the Second Intifada erupted from 2000 to 2005. The peace process has stalled since.

Most Palestinians now believe that the two-state solution, which the Biden administration says it is committed to, is no longer feasible because of Israeli settlement expansion in the West Bank, recent polling from the Palestinian Center for Policy and Survey Research shows.

Israeli settlers now number about 700,000 in the West Bank and East Jerusalem, making it difficult to administer a future Palestinian state. Violence by Israeli settlers against Palestinians , which has increased since Oct. 7, is a top concern among Palestinians in the West Bank.

Violence intensifies

Mohammed Saleh , a 14-year-old boy from As-Sawiya, a village south of Nablus, has seen attacks against Palestinians intensify as the settlements grow.

On Oct. 28, armed settlers approached Mohammed’s father, Bilal, as he picked olives in their family’s grove. An Israeli opened fire, striking Bilal, in what Mohammed’s family believes was a revenge attack against Palestinians for Hamas’s Oct. 7 assault. The father bled out as he was transported on the wooden ladder he had just used to reach olive branches. He died in front of his son.

“I am just a boy, but now I am the man of the house,” Mohammed said.

The Israeli military said it opened an investigation and took the alleged shooter, an off-duty soldier, into custody for questioning. The military didn’t respond to questions about whether the shooter was charged or remained in custody.

“Naturally, it is not possible to give details about an ongoing investigation,” the military said in a statement.

Mohammed said he now anxiously keeps watch for armed settlers. Still, he plans to root himself in the village, maintaining the traditions of his father.

“I will think of him every time I smell sage or pick olives,” Mohammed said. “And I will study law so I can defend our people with the strongest weapon: education.”

Threats at home—and abroad

Life sometimes feels normal for Marian Awartani , a Palestinian-American dual national living in Ramallah, the West Bank’s de facto Palestinian capital. Her tightknit group of teenage friends sing loudly as they drive with the windows open. They gossip about boys in both Palestinian Arabic and American English.

But it doesn’t take much to remind Marian, 17, that life is far from normal. During a recent picnic in one of the few available green spaces around the city, a drone swooped down from around a nearby watchtower, blaring an alarm and demanding in Hebrew for the group to leave. The drone hovered above Marian, her friends and two Wall Street Journal journalists as they hurried toward their cars and drove off.

“Even in a place I have been going to since I was a small child, one day an Israeli drone can tell me that I am not allowed there, and that’s that,” Marian said.

In November, her brother, a Brown University student, was shot while walking near their grandmother’s house in Vermont. The family believes he and two friends accompanying him were targeted in a hate crime because two were wearing traditional Palestinian scarves. The shooter pleaded not guilty to three counts of attempted second-degree murder; the court case is ongoing.

“It further solidified that we don’t belong anywhere,” Marian said.

Marian says she is seeking ways to humanize Palestinians, including to Israelis on the other side of the West Bank wall. More dialogue could get people to understand each other more, Marian said.

“But how can we communicate with the other side, when there is a wall between us, and our people are getting killed daily?”

Write to Omar Abdel-Baqui at omar.abdel-baqui@wsj.com