Former Israeli prime minister Yitzhak Shamir, a gunman in the smallest and most violent underground faction fighting for a Jewish state who rose to become leader of the nation during the pivotal years when Israel emerged as a modern, middle-class country, died June 30 at a nursing home in Herzliya, Israel. He was 96.

He reportedly had Alzheimer’s disease. The office of Israeli Prime Minister Benjamin Netanyahu announced his death.

The place and circumstances of his death were not immediately clear.

A man of iron will and simple tastes, Mr. Shamir prided himself on his hard-line views, his relentless determination to hang onto every square inch of what he considered the Land of Israel, and his championing of Jewish settlements in the Israeli-occupied West Bank and Gaza Strip, defying the demands of Israel’s most important ally, the United States.

He first served as prime minister for a year after Menachem Begin’s sudden resignation in 1983, then returned to power for six tumultuous years from 1986 to 1992. Much of that period was dominated by the first Palestinian intifada, an uprising that shattered the old terms of Israel’s domination of its Palestinian subjects and compelled even Mr. Shamir to make concessions that he had never anticipated.

At the same time, he presided over an era of growing prosperity and consumerism in the late 1980s and early ’90s that inexorably drove Israel to seek accommodation with many of its Arab foes and laid the groundwork for Mr. Shamir’s own political demise. Still, Mr. Shamir was Israel’s second-longest serving prime minister after founding father David Ben-Gurion.

In the end, Mr. Shamir’s miscalculation of the patience and persistence of President George H.W. Bush and Bush’s canny secretary of state, James Baker, triggered a diplomatic showdown that set the stage for Mr. Shamir’s defeat by opposition party leader Yitzhak Rabin in 1992.

Still, Mr. Shamir’s vision for Israel — a strong, unassailable nation capable of defeating any enemy and continuing down the path of colonizing the West Bank even while establishing itself as an economic success story — endures.

“There is the sense that no one had the impact that he had,” said Avishai Margalit, an Israeli philosopher at Princeton University. “He was the ultimate true believer in the idea of Greater Israel.”

Mr. Shamir was a barrel-chested man with wavy gray hair and bushy eyebrows that topped an asymmetrical rubbery face and a trim, almost indiscernible mustache. He was barely 5-foot-4, a physically unremarkable person who readily blended into a crowd. Yet he was neither frail nor easily intimidated.

Former prime minister Ariel Sharon, who was both Mr. Shamir’s occasional political partner and main rival for power within the ruling Likud party, recalled in his memoirs taking Mr. Shamir, then foreign minister, on a clandestine trip to Lebanon during the early 1980s to meet with the Christian warlords who were then allied with Israel. The two men found themselves caught in the middle of a flare-up between rival gunmen. “While I was used to this kind of thing, having been to Beirut so many times, Shamir was not,” Sharon wrote. “I glanced at him and saw his face showed absolutely no trace of emotion. The man had complete self-control.”

Underground years

Yitzhak Yezernitsky was born in Ruzinoy, Poland, on Oct. 15, 1915, to a relatively affluent family, most of which was later wiped out in the Holocaust. (His birth name was sometimes spelled Jazernicki.)

He attended a Hebrew high school and at 14 joined Betar, a youth organization created by Zeev Jabotinsky, head of the “revisionist” right wing of the Jewish national movement known as Zionism. He came to British-ruled Palestine on a student visa at 19 and registered for law school at the new Hebrew University in Jerusalem. But he had come not to study the legal order but to overthrow it. He changed his name to Shamir, a Hebrew word for thorn.

He quickly dropped out of school and joined the Irgun, which was led by Begin and the smaller of the two armed Zionist movements seeking to establish a state for the 400,000 Jews living in the territory among 1 million Arabs. When the Irgun split in 1938, Mr. Shamir sided with the smaller, more extreme faction known as Lehi — a Hebrew acronym for “Fighters for Israel’s Freedom” — and also known as the Stern Gang after its melodramatic, poetry-spouting leader, Avraham Stern.

After Stern was gunned down by British police in 1942, Mr. Shamir escaped from a detention camp and became one of a triumvirate of leaders. While mainstream Zionist groups forged a truce with the British to combat Nazism during World War II, Mr. Shamir and Lehi fought on, even offering to cooperate with the Germans to rid Palestine of British rule.

Mr. Shamir was the architect of Lehi’s most daring attack, the 1944 assassination in Cairo of Lord Moyne, Britain’s top Middle East official and a close friend of Prime Minister Winston Churchill. Along the way Mr. Shamir married one of his own agents, Sarah Levy, code-named Shulamit. She died in 2011. Survivors include their two children, Gilada Diamant of Tel Aviv and Yair Shamir of Savyon, Israel; five grandchildren; and seven great-grandchildren.

After the war, Mr. Shamir was arrested and escaped again, returning to Palestine in time to join the war for Israel’s independence in 1948. He helped plot the assassination of United Nations mediator Folke Bernadotte, who was working on a partition plan to end the war on terms that Mr. Shamir deemed dangerous. Mr. Shamir’s men ambushed Bernadotte’s car at a checkpoint in West Jerusalem.

Mr. Shamir seldom spoke about his underground work. But in speaking of Moyne’s killing, he gave author Gerold Frank a cold-blooded summation of the terrorist’s creed: “A man who goes forth to take the life of another whom he does not know must believe one thing only — that by his act he will change the course of history.”

After Israel gained its independence, Mr. Shamir was shunned by Ben-Gurion and the Labor Zionist establishment. But in 1955, he was recruited by the head of the Mossad, Israel’s top-secret intelligence agency. He spent more than a decade as a mid-level agent.

Begin, now leader of the right-of-center coalition movement that eventually became the Likud, rescued Mr. Shamir from obscurity in 1970, giving him a job as a political lieutenant and bestowing upon him a safe seat in the Israeli parliament in 1973. Mr. Shamir became speaker of the Knesset when Begin and Likud won a stunning electoral triumph in 1977. He eventually rose to foreign minister.

Although Mr. Shamir was known for his doggedly faithful service, he balked when Begin signed the 1978 Camp David peace accords with Egypt, voting against the treaty in the Knesset because it returned all of the Israeli-occupied Sinai peninsula to Egyptian control. After Begin surprised his followers by stepping down in 1983, Mr. Shamir, who was 68, was chosen to serve as a caretaker prime minister until younger and more popular politicians could sort out the succession.

But as he often did throughout his career, Mr. Shamir persevered, outwitting his younger, seemingly stronger political rivals. Under his guidance, Likud managed to dodge a massive electoral defeat in 1984 to finish a close second to the opposition Labor Party. Mr. Shamir forced Labor into a unity government in which the premiership rotated between Mr. Shamir and Labor Party leader Shimon Peres, with Mr. Shamir returning to the prime minister’s office in 1986. Two years later, Likud won a narrow one-seat victory in parliament.

Second term

Mr. Shamir ran the prime minister’s office like a clandestine underground movement. He often met separately with each aide, compartmentalizing tasks and duties. There were huge gaps in his official diary, when aides said Mr. Shamir spent his time alone poring over diplomatic cables and intelligence reports. He preferred raw data from field agents. Aides said the papers would always be returned unmarked. No one could tell by examining them what had caught the prime minister’s eye.

He surprised many observers in 1991 by scrupulously following the Bush administration’s pleas in not retaliating during the Persian Gulf War, even after Iraqi leader Saddam Hussein fired more than 40 Scud missiles at Israeli cities and towns. An Israeli military response could have shattered the coalition of Arab states and other countries that Bush and Baker built to drive Iraqi forces out of Kuwait.

Mr. Shamir expected his restraint to be rewarded, but instead Bush and Baker saw the end of the Gulf War as a window of opportunity to press for peace between Israel and its Arab neighbors. They cajoled Mr. Shamir into attending a peace conference in Madrid with Arab leaders and local Palestinians loyal to the Palestine Liberation Organization. Mr. Shamir made an appearance but gave an unyielding speech.

With the decline of the Soviet Union, nearly a half-million Soviet Jews immigrated to Israel, and Mr. Shamir sought $10 billion in U.S.-backed loan guarantees to pay for housing and development projects. But he resisted American demands that none of the money be used for Jewish settlements in the occupied territories.

On Sept. 12, 1991, hundreds of American Jewish citizen lobbyists hit congressional offices in support of the loan guarantees. The president held a news conference in which he declared his administration had “one lonely little guy” up against “something like a thousand lobbyists.” The pro-Israel lobbying effort collapsed overnight. Israeli voters, wary of a confrontation with the country’s one reliable ally, rejected Mr. Shamir in the June 1992 election.

After his electoral defeat, Mr. Shamir stepped down from his party’s leadership but remained in the Knesset until 1996. He ardently opposed the Oslo peace accord between Israel and the PLO as a sellout of Jewish principles. As his health deteriorated, he entered a nursing home. A newspaper report in 2006 suggested he no longer recognized visitors.

Mr. Shamir never ceased believing that the world was a dangerous place for Jews, that it was important to have powerful friends, but that in the end Jews could only trust in themselves. His heroes were ruthless, decisive leaders like Lenin and Mao. He saved his most scathing disdain for fellow Jews. Those who met with PLO leaders in the days of the first intifada were “traitors.” Advocates of territorial compromise were “defeatists” and “collaborators.” Even the young circle of supporters whom he mentored and cultivated — including Ehud Olmert, a future prime minister — were suspect in some way.

“He heard every whisper, every small movement,” Yossi Achimeir, a close aide, once recalled. “His antennae were working all the time.” Ultimately, said Achimeir, “Shamir believed only in Shamir.”