For months, Yahya Sinwar has resisted pressure to cut a ceasefire-and-hostages deal with Israel. Behind his decision, messages the Hamas military leader in Gaza has sent to mediators show, is a calculation that more fighting—and more Palestinian civilian deaths—work to his advantage.

“We have the Israelis right where we want them,” Sinwar said in a recent message to Hamas officials seeking to broker an agreement with Qatari and Egyptian officials.

Fighting between Israeli forces and Hamas units in the Gaza Strip’s south has disrupted humanitarian-aid shipments, caused mounting civilian casualties and intensified international criticism of Israel’s efforts to eradicate the Islamist extremist group.

For much of Sinwar’s political life , shaped by bloody conflict with an Israeli state that he says has no right to exist, he has stuck to a simple playbook. Backed into a corner, he looks to violence for a way out. The current fight in Gaza is no exception.

In dozens of messages—reviewed by The Wall Street Journal—that Sinwar has transmitted to cease-fire negotiators, Hamas compatriots outside Gaza and others, he’s shown a cold disregard for human life and made clear he believes Israel has more to lose from the war than Hamas. The messages were shared by multiple people with differing views of Sinwar.

More than 37,000 people have been killed in Gaza since the start of the war, most of them civilians, Palestinian officials say. The figure doesn’t specify how many were combatants. Health authorities said almost 300 Palestinians were killed Saturday in an Israeli raid that rescued four hostages kept in captivity in homes surrounded by civilians—driving home for some Palestinians their role as pawns for Hamas.

In one message to Hamas leaders in Doha, Sinwar cited civilian losses in national-liberation conflicts in places such as Algeria, where hundreds of thousands of people died fighting for independence from France, saying, “these are necessary sacrifices.”

In an April 11 letter to Hamas political leader Ismail Haniyeh after three of Haniyeh’s adult sons were killed by an Israeli airstrike , Sinwar wrote that their deaths and those of other Palestinians would “infuse life into the veins of this nation, prompting it to rise to its glory and honor.”

Sinwar isn’t the first Palestinian leader to embrace bloodshed as a means to pressure Israel. But the scale of the collateral damage in this war—civilians killed and destruction wrought —is unprecedented between Israelis and Palestinians.

Despite Israel’s ferocious effort to kill him, Sinwar has survived and micromanaged Hamas’s war effort, drafting letters, sending messages to cease-fire negotiators and deciding when the U.S.-designated terrorist group ramps up or dials back its attacks.

His ultimate goal appears to be to win a permanent cease-fire that allows Hamas to declare a historic victory by outlasting Israel and claim leadership of the Palestinian national cause.

President Biden is trying to force Israel and Hamas to halt the war. But Israeli Prime Minister Benjamin Netanyahu is opposed to permanently ending the fight before what he calls “total victory” over Hamas.

Even without a lasting truce, Sinwar believes Netanyahu has few options other than occupying Gaza and getting bogged down fighting a Hamas-led insurgency for months or years.

It is an outcome that Sinwar foreshadowed six years ago when he first became leader in the Gaza Strip. Hamas might lose a war with Israel, but it would cause an Israeli occupation of more than two million Palestinians.

“For Netanyahu, a victory would be even worse than a defeat,” Sinwar told an Italian journalist writing in 2018 in an Israeli daily, Yedioth Ahronoth.

Sinwar, now in his early 60s, was roughly 5 years old when the 1967 war brought him his first experience of significant violence between Israelis and Arabs. That brief fight reordered the Middle East. Israel took control of the Golan Heights from Syria and the West Bank from Jordan. It also captured the Sinai Peninsula from Egypt, as well as the Gaza Strip, where Sinwar grew up in a United Nations-run refugee camp.

The conflict was a constant presence. Sinwar published a novel in 2004 while in Israeli prison and wrote in the preface that it was based on his own experiences. In the book, a father digs a deep hole in the yard of the refugee camp during the 1967 war, covering it with wood and metal to make a shelter.

A young son waits in the hole with his family, crying and hearing the sounds of explosions grow louder as the Israeli army approaches. The boy tries to climb out, only for his mother to yell: “It’s war out there! Don’t you know what war means?”

Sinwar joined the movement that eventually became Hamas in the 1980s, becoming close to founder Sheikh Ahmed Yassin, and setting up an internal-security police that hunted and killed suspected informants, according to the transcript of his confession to Israeli interrogators in 1988.

He received multiple life sentences for murder and spent 22 years in prison before being freed in a swap along with a thousand other Palestinians in 2011 for Israeli soldier Gilad Shalit.

During the negotiations between Israel and Hamas over the Shalit swap, Sinwar was influential in pushing for the freedom of Palestinians who were jailed for murdering Israelis.

He wanted to release even those who were involved in bombings that had killed large numbers of Israelis and was so maximalist in his demands that Israel put him in solitary confinement so he wouldn’t disrupt progress.

When he became leader of Hamas in Gaza in 2017, violence was a constant in his repertoire. Hamas had wrested control of Gaza from the Palestinian Authority in a bloody conflict a decade earlier, and while Sinwar moved early in his tenure to reconcile Hamas with other Palestinian factions, he warned that he would “break the neck” of anyone who stood in the way.

In 2018, Sinwar supported weekly protests at the fence between Gaza and Israeli territory. Fearful of a breach in the barrier, the Israeli military fired on Palestinians and agitators who came too close. It was all part of the plan.

“We make the headlines only with blood,” Sinwar said in the interview at the time with an Italian journalist. “No blood, no news.”

In 2021, reconciliation talks between Hamas and Palestinian factions appeared to be progressing toward legislative and presidential elections for the Palestinian Authority, the first in 15 years. But at the last moment, Palestinian Authority President Mahmoud Abbas canceled polls. With the political track closed, Sinwar days later turned to bloodshed to change the status quo, firing rockets on Jerusalem amid tensions between Israelis and Palestinians in the city. The ensuing 11-day conflict killed 242 Palestinians and 12 people in Israel.

Israeli airstrikes caused such damage that Israeli officials believed Sinwar would be deterred from again attacking Israelis.

But the opposite happened: Israeli officials now believe Sinwar then began planning the Oct. 7 attacks. One aim was to end the paralysis in resolving the Israeli-Palestinian conflict and revive its global diplomatic importance, said Arab and Hamas officials familiar with Sinwar’s thinking.

Israel’s occupation of the Palestinian territories had lasted more than half a century, and Netanyahu’s far-right coalition partners were talking about annexing land in the West Bank that Palestinians wanted for a future state. Saudi Arabia, once a champion of the Palestinian cause, was in talks to normalize relations with Israel .

Though Sinwar planned and greenlighted the Oct. 7 attacks, early messages to cease-fire negotiators show he seemed surprised by the brutality of Hamas’s armed wing and other Palestinians, and how easily they committed civilian atrocities.

“Things went out of control,” Sinwar said in one of his messages, referring to gangs taking civilian women and children as hostages. “People got caught up in this, and that should not have happened.”

This became a talking point for Hamas to explain away the Oct. 7 civilian toll.

Early in the war, Sinwar focused on using the hostages as a bargaining chip to delay an Israeli ground operation in Gaza. A day after Israeli soldiers entered the strip, Sinwar said Hamas was ready for an immediate deal to exchange its hostages for the release of all Palestinian prisoners held in Israel.

But Sinwar had misread how Israel would react to Oct. 7. Netanyahu declared Israel was going to destroy Hamas and said the only way to force the group to release hostages was through military pressure.

Sinwar appears to have also misinterpreted the support that Iran and Lebanese militia Hezbollah were willing to offer.

When Hamas political chief Haniyeh and deputy Saleh al-Arouri traveled to Tehran in November for a meeting with Iranian Supreme Leader Ayatollah Ali Khamenei , they were told that Tehran backed Hamas but wouldn’t be entering the conflict.

“He was partly misled by them and partly misled himself,” said Ehud Yaari, an Israeli commentator who has known Sinwar since his days in prison. “He was extremely disappointed.”

By November, Hamas’s political leadership privately began distancing themselves from Sinwar, saying he launched the Oct. 7 attacks without telling them, Arab officials who spoke to Hamas said.

At the end of November, Israel and Hamas agreed to a cease-fire and the release of some hostages held by the militants. But the deal collapsed after a week.

As Israel’s army quickly dismantled Hamas’s military structures, the group’s political leadership began meeting other Palestinian factions in early December to discuss reconciliation and a postwar plan. Sinwar wasn’t consulted.

Sinwar in a message sent to the political leaders blasted the end-around as “shameful and outrageous.”

“As long as fighters are still standing and we have not lost the war, such contacts should be immediately terminated,” he said. “We have the capabilities to continue fighting for months.”

On Jan. 2, Arouri was killed in a suspected Israeli strike in Beirut, and Sinwar began to change the way he communicated, said Arab officials. He used aliases and relayed notes only through a handful of trusted aides and via codes, switching between audio, messages spoken to intermediaries and written messages, they said.

Still, his communications indicate he began to feel things were turning Hamas’s way.

By the end of that month, Israel’s military advance had slowed to a grueling battle in the city of Khan Younis, Sinwar’s hometown. Israel began to lose more troops. On Jan. 23, about two dozen Israeli troops were killed in central and southern Gaza, the invasion’s deadliest day for the military.

Arab mediators hastened to speed up talks about a cease-fire, and on Feb. 19, Israel set a deadline of Ramadan—a month later—for Hamas to return the hostages or face a ground offensive in Rafah, what Israeli officials described as the militant group’s last stronghold.

Sinwar in a message urged his comrades in Hamas’s political leadership outside Gaza not to make concessions and instead to push for a permanent end to the war. High civilian casualties would create worldwide pressure on Israel, Sinwar said. The group’s armed wing was ready for the onslaught, Sinwar’s messages said.

“Israel’s journey in Rafah won’t be a walk in the park,” Sinwar told Hamas leaders in Doha in a message.

At the end of February, an aid delivery in Gaza turned deadly as Israeli forces fired on Palestinian civilians crowding trucks, adding U.S. pressure on Israel to limit casualties.

Disagreements among Israel’s wartime leaders erupted into public view , as Netanyahu failed to articulate a postwar governance plan for Gaza and his defense minister, Yoav Gallant, privately warned against reoccupying the strip. Israelis grew concerned the country was losing the war .

In May, Israel again threatened to attack Rafah if cease-fire talks remained deadlocked, a move Hamas viewed as purely a negotiating tactic.

Netanyahu said Israel needed to expand into Rafah to destroy Hamas’s military structure there and disrupt smuggling from Egypt.

Sinwar’s response: Hamas fired on Kerem Shalom crossing May 5, killing four soldiers. Hamas officials outside Gaza began to echo Sinwar’s confident posture.

Israel has since launched its Rafah operation. But as Sinwar predicted, it has come at a humanitarian and diplomatic cost.

Sinwar’s messages, meanwhile, indicate he’s willing to die in the fighting.

In a recent message to allies, the Hamas leader likened the war to a 7th-century battle in Karbala, Iraq, where the grandson of the Prophet Muhammad was controversially slain.

“We have to move forward on the same path we started,” Sinwar wrote. “Or let it be a new Karbala.”

In his messages, Sinwar has indicated he’s willing to die in the fighting. PHOTO: AHMED DEEB FOR THE WALL STREET JOURNAL

Write to Summer Said at summer.said@wsj.com and Rory Jones at Rory.Jones@wsj.com