The two cousins spotted each other on the bus leaving the prison, as shocked to see the other as they were by their sudden freedom. “Pinch me,” Anwar Atta, 18, told his younger cousin. “I need to know if this is a dream.”

Then, early Sunday morning, the bus pulled out of Ofer Prison in the West Bank and into a throng of cheering Palestinians. Before the cousins’ feet could touch the ground, they were hoisted into the air and carried through the streets of Ramallah, surrounded by people waving Palestinian and Hamas flags, revving their motorcycle engines and whistling in excitement.

“This is thanks to the resistance in Gaza,” Anwar said hours later from his family’s home on the outskirts of the city.

Anwar and his cousin, Mourad Atta, 17, are among the 180 Palestinian teenagers and women freed from Israeli prisons in recent days, the largest such release of prisoners and detainees in more than a decade. Their freedom is part of a deal in which the Palestinians were traded for 81 hostages, many of them children, captured during the Hamas-led terrorist attack in Israel on Oct. 7. The deal also included a temporary cease-fire in the war in Gaza, which has killed more than 13,000 people, according to Gazan officials.

Israel’s bombardment of Gaza and the elation over the prisoners’ release have deepened support for Hamas in the Israeli-occupied West Bank, where the Palestinian Authority has administered cities and towns for two decades. Gaza, the other Palestinian enclave, has by contrast been controlled since 2007 by Hamas.

Now, as many in the West Bank fear the war could spread to the occupied territory, some believe Hamas and other armed groups are the only ones they can trust to protect them.

The Palestinian Authority — which is controlled by the Fatah political faction — is deeply unpopular and widely seen as a subcontractor to the Israeli occupation. Long-simmering frustrations with the authority’s leadership and accusations of corruption have been exacerbated in the past year by an uptick in violence by Israeli settlers.

For some Palestinians living under military occupation in the West Bank, the freed prisoners have become a potent symbol of Hamas’s ability to achieve tangible results and its willingness to fight for the Palestinian cause. Each night in Ramallah, as new batches of prisoners were released, one refrain echoed across the crowds: “The people want Hamas! The people want Hamas!”

Pollsters and analysts caution that support for the group is limited to a minority of residents and tends to rise temporarily during conflicts in Gaza. But with fears that a wider war could break out in the West Bank, many say the growing support today has taken on a new, more existential quality.

There is a growing sense that people need protection and they “don’t have any alternative,” said Ghassan Khatib, director of the Jerusalem Media and Communication Center, which specializes in research and opinion polling. “The only game in town is Hamas.”

Hours after his release, Anwar Atta and his cousin Mourad sat outside their families’ homes in Deir Abu Masha’al, a village of around 4,000 people on the outskirts of Ramallah. A steady stream of neighbors and relatives came to welcome them home, smoking cigarettes and drinking small cups of coffee.

“Where have you been, it’s been a while,” Anwar’s aunt, Halima Atta, chided him as she held him in her arms. “Are you going to keep making trouble?”

“I’m done, OK? I’m done,” he replied.

“No, you have a beard now — you’re a man,” Halima joked.

The reunion was years in the making. Anwar was arrested in June 2021, which he says was for throwing stones at Israeli soldiers — an act of resistance spurred by an Israeli military offensive in Gaza a month earlier. The Israeli authorities say he threw an “incendiary device.”

Over the more than two years he spent awaiting trial, Anwar had come to accept that most of his early adulthood would be spent behind bars — a price he was willing to pay to defend his land, he said.

After the Oct. 7 attack, which Israeli officials say killed an estimated 1,200 people, news of Hamas taking hostages spread between the cells at Ofer Prison — sparking hope that a prisoner release could follow. Inmates clapped and cheered, crying “God is great” and praising the armed resistance, Anwar recalled.

The weeks that followed, he said, were the harshest of his time in prison. Anwar, other recently released prisoners and human rights group say that prison officials rationed water and electricity. They confiscated TVs and radios, and barred relatives from visiting — effectively creating an information blackout. And as prison officials’ stepped up their searches for contraband, they forced inmates to kneel on the floor and beat them, released prisoners and rights groups said.

The Israeli prison service has said that it has imposed tighter restrictions in prisons in recent weeks — including confiscating electronics, canceling family visits and carrying out hundreds of searches — in connection with the war effort. Officials say that prisoners are able to file complaints that would be examined by the authorities.

Hundreds of new inmates also flooded into the prison — some of the more than 2,000 Palestinians arrested since Oct. 7 — and shared news of the war in hushed whispers, Anwar said. The inmates devoured each morsel of new information, both stunned at the sheer devastation in Gaza and wondering if the war could also bring their freedom.

Then last week, the moment Anwar had been praying for arrived.

Early Sunday morning, Mourad’s mother was sitting on the sagging couch in their living room, watching the news on TV and agonizing over whether her son would be among those released. When she saw Mourad and Anwar’s faces flash across the screen waving from the bus of prisoners, she leaped from her seat.

“We were screaming and jumping and crying — we couldn’t believe it,” his mother, Amal Atta, 35, said.

Mourad was arrested after throwing stones at Israeli soldiers in August 2022, prompted by a days-long military offensive in Gaza by Israel earlier that month, he said. Israeli authorities accused him of throwing an explosive device. Like his cousin, he, too, was never tried.

The teenagers’ return to the village has been celebrated for days; young children have run around their houses devouring sweets while older relatives have pulled Anwar and Mourad in for hugs.

“Why do you think he was in prison? It’s because of everything he’s seen here, everything he’s exposed to — it made him want to go out and fight back,” Anwar’s uncle, Omar Atta, 45, said, sitting among their relatives Sunday evening.

As his relatives hugged nearby, Omar looked out over the hillside, a crisp breeze rattling the branches of the olive trees below. Since the war began, Israeli soldiers have erected a new barricade blocking the only paved road leading to their village. Israeli security forces have raided homes in the village and arrested around a dozen of his neighbors, he said. Frustration and anger has swelled.

“Israel thinks they are suppressing or destroying the resistance,” Omar explained. “But look at what they are doing. They are only making it stronger.”

Rami Nazzal contributed reporting from Ramallah.