Before Amr Khamour, 14, was killed, shot twice by Israeli troops as he hurled stones at a military jeep in his hometown, he spent his time dancing with friends, recording TikTok videos on his phone.

But after his death in January, his parents found a photograph of a handwritten farewell message on his phone. “If I come to you a martyr, God willing,” he wrote his mother, “don’t cry. And forgive me for every mistake I made.”

“Don’t be sad, father,” Amr continued, “I wished for martyrdom and I received it.” Then he finished with words of love for his childhood sweetheart: “God gave me the person dear to my heart, Kariwan.”

Fighters who have taken up arms against Israel with groups like Hamas and Palestinian Islamic Jihad have long left behind final testaments, sometimes high-quality videos, to take responsibility for attacks in which they expect to lose their lives.

Now, young Palestinians, like Amr — not affiliated with the territories’ armed groups but nonetheless willing to confront Israeli troops — are leaving behind messages of their own. These farewells for loved ones, requests for forgiveness and exhortations to fight against Israel are known as “wills” in Arabic, even if their authors are not leaving behind any material goods. Many scrawl them on notebook paper, with scratched-out words a sign of their uncertainty about what to say.

The farewell testaments reflect a prevailing sense among many young men that death is heroic, meaningful and inevitable during what is now the deadliest period for Palestinians in nearly two decades in the Israeli-occupied West Bank.

This week, Israel, saying it wanted to root out armed groups, launched its largest military incursion in decades in the West Bank, in the Palestinian city of Jenin, killing at least 12 Palestinians, carrying out airstrikes and destroying roads and infrastructure, local officials said.In all, at least 155 Palestinians have been killed this year, mostly during Israeli military raids in Palestinian towns and cities, or in attacks by extremist Israeli settlers.

It has also been a particular deadly time for Israelis. The military raids were stepped up last year after a spate of attacks by Palestinians on Israelis. So far this year, at least 29 Israelis have been killed by Palestinian assailants, one of the highest tolls since 2008.

With the intensifying violence, many young Palestinians feel added pressure that they themselves must become involved in the struggle against Israel and act.

Palestinian society has long lionized “martyrs” — anyone killed by Israeli forces — with many of their images displayed on walls and banners in Palestinian cities and, more recently, on social media platforms like Instagram.

Farewell messages are often published by the Palestinian news media and shared widely on social media, inspiring more young Palestinians to write their own.

Dr. Samah Jabr, the head of the mental health unit for the Palestinian Authority, said the writing of such wills was wrapped up with generational traumas for Palestinians living in the occupied territories, dealing with checkpoints and near daily raids by Israeli troops. Many young people feel a duty to take on adult roles, including confronting Israeli troops.

When Jalal Abukhater, a Palestinian writer based in Jerusalem and the West Bank, goes to the wakes of young Palestinians to pay his respects, he said, he often hears their friends talking about following in their paths.

“It’s not that they want to die, but it’s that they feel like there’s nothing else to give to Palestine except martyrdom,” Mr. Abukhater said. “They think just throwing rocks at the Jeep is the bravest act.”

Some of the farewell messages written by young Palestinians in recent months have cited the words of Uday al-Tamimi, 22.

While on the run after shooting at an Israeli checkpoint at the entrance of the Shuafat refugee camp, killing one soldier, he wrote a message in which he said his attack “was a drop in the stormy sea of the struggle.”

“I know that I will be martyred sooner or later, and I know that I did not liberate Palestine through this operation,” wrote Mr. Tamimi, a resident of the camp. “But I carried it out with a goal in mind; for the operation to mobilize hundreds of young men to carry arms after me.”

Others have cited the words of Ibrahim al-Nabulsi, 18, a member of a local armed group in Nablus, who left a brief voice recording as he was cornered by Israeli forces in the moments before he was killed.

Mental health experts like Dr. Jabr and Ayed Houshia, a counselor at a boy’s school in the Dheisheh Camp, said they and others needed to help Palestinian youths channel fears or frustrations into productive actions instead of confrontations with Israel forces that could get them killed.

Amr’s parents said they had tried preventing their son from sneaking out at night when Israeli forces raided their town, near Bethlehem.

The Israeli military said it had raided Dheisheh on the morning of Amr’s killing as part of a “counterterrorism activity to apprehend individuals.” It would not say whom the soldiers were there to detain, but Palestinian state media reported that the army had detained an Italian activist.

The military said it was investigating Amr’s killing but gave no other details.

Less than two weeks before Amr was killed, his friend, Adam Ayyad, 15, was shot and killed during a similar army raid into Dheisheh. Like Amr, he would sneak out of his home when the army raided the camp to confront the soldiers and throw stones, his family said.

About a month before Adam’s death, his mother, Wafaa Ayyad, found a farewell message from him. She ripped it up and begged him not to write another one, she said.

But he did, keeping it in his pocket, where it was found after he was shot and taken to the hospital.

“I wanted to do many things, but we live in a place where achieving your dreams is impossible,” Adam wrote. “Martyrdom is victory. It’s true that your life ends, but at least it ends in happiness.”

Days later, Amr visited Adam’s grave in what is known as the martyr’s cemetery on the outskirts of Dheisheh. He told his friends he wanted to be buried in the empty plot next to Adam.

Around that time, Mr. Houshia, the school counselor, gathered his students and told them that resisting the Israeli occupation was not just about taking up arms — it could mean studying and planning a future, as well. He advised them not to write farewell messages of their own.

“Why is a 13-year-old child thinking of his death before he is thinking of his future?” Mr. Houshia said.

Some of the students pushed back, insisting that a Palestinian homeland required sacrifice. Others admitted having already prepared their final messages, said Mohammad al-Afendi, 15, a 10th grader who attended the meeting.

After the sessions, he said, Mr. Houshia heard from some parents who reported that their sons had begun talking more about their futures and their studies. But such counseling interventions are overshadowed by the daily reality the youths live in, he said.

“We can counsel the students, but we can’t prevent the army from raiding the camp,” he said. “The occupation is the biggest driver among the youth who ask why they should stop when they are subjected to war and death.”

Months after Amr’s death, his friends often join his mother when she visits his grave, in the very plot where he said he wanted to be buried. It is covered in a sea of flowers, real and artificial, which she carefully tends.

A few of Amr’s friends admit to having already written their wills. There are also other indications that some of them may follow in his path.

On one side of the cemetery, there is a row of empty graves. Like Amr, some of his friends say they have already claimed their plots.