Menachem Begin yesterday formally ended a remarkable political career that spanned more than five decades, from his beginnings in a militant Zionist youth group in Poland to his ultimate role as prime minister of Israel and a shaper of the future of the Middle East.

Throughout the turbulent years in between, Begin was a relatively unknown figure, lost among better-known names such as David Ben-Gurion and Golda Meir. Even at the end of his career, he appeared something of an anomaly; this small, bespectacled man, bent by the personal and political blows he had suffered in recent months, yet hailed by his supporters as king of the Jews as he carried out the formal acts of a democratic change of power.

It was his deeply rooted belief in the glories of ancient Israel that made Begin's brand of nationalism so attractive to the largely native Middle Eastern Jewish population and catapulted him to power, changing the face of Israeli politics.

Until Israel's Labor Party ran out of political miracles in 1977, Begin was always on the outside looking in--as a dissident from the mainstream of the Zionist movement, as an underground fighter against British rule in Palestine in the late 1940s and, for three decades, as the leader of the opposition in parliament.

Within months of moving into the prime minister's office, Begin presided over an event none of his predecessors had been able to bring about--the arrival of the leader of a major Arab state in Jerusalem.

It was an emotional and historical high point. After years of operating from the periphery of established power, he soon found himself at Camp David with presidents Jimmy Carter and Anwar Sadat, dramatically redirecting the future of the Middle East and winning, along with Sadat, the Nobel Peace Prize.

Once the months-long process of cementing peace with Egypt was accomplished, however, Begin became embroiled in continuing international controversy--over the future of the West Bank and over Israel's troubled northern border with Lebanon.

The course he chose brought periods of extreme tension to the U.S.-Israeli relationship and ultimately severely tested the ties of large segments of American Jewry to Israel.

While it is the West Bank and its fate that over time is certain to figure most heavily in the region's future, it was Lebanon that proved the most dramatic testing ground for these relationships as well as for Israel's own internal political debate.

Vowing that Israelis should never face a threat from the north, Begin sent the Israeli Army into Lebanon in June 1982 on a route that eventually led to the outskirts of the Palestinian camps at Sabra and Shatila, in west Beirut. There, in an act that was to shake Israel's society and create doubts about its most honored institution, the Army, members of the Israeli-allied Phalangist militia entered the camps and hundreds of Palestinians were killed.

A commission of inquiry, initially fought by Begin, found the Israeli government, although not necessarily Begin personally, indirectly at fault for the massacre. In the end, his defense minister, Ariel Sharon, was forced to resign, but Begin's sense of political loyalties, or perhaps of political survival, would not allow him to remove Sharon from the Cabinet altogether.

Less dramatic, at least to the world outside Israel, were his policies on the home front, where he moved to dismantle many of the socialist institutions built up by his predecessors in hopes of revitalizing the Israeli economy.

Israel continued to be torn by raging inflation throughout the Begin years, and little progress was made toward integrating the growing segment of the population from less-advanced Middle Eastern countries into what was increasingly a technologically oriented economy.

Just as Begin himself was molded by ancient history and by his formative years before Israel's existence, the passage of Israel's first three decades as a state set the stage that allowed him to come to office and shaped his prime ministership.

Not only had Labor Party leaders grown politically sloppy during three decades in power, but the demographics of Israel had changed, with Jews who traced their backgrounds to Europe giving way to those from Middle Eastern countries. Politically, the newcomers were not drawn to Labor's European Socialist tradition and this gave Begin, the longtime ideological foe of Labor, a reservoir of support out of which he could build his coalition government.

While much was made of Begin's fundamentalist views because of his political links to Israel's religious parties and his beliefs in Israel's historical right to all of ancient Palestine, he does not appear to have been firmly rooted in religious orthodoxy, although he was more observant in religious practice than other Israeli prime ministers have been.

His was a nationalist orthodoxy, unhindered by the attachments to socialism and the idealistic standards that characterized the mainstream Zionist movements and eventually emerged in the Labor Party governments that led Israel for its first three decades as a modern state.

He followed the teachings of militant Zionist Vladimir Jabotinsky, who believed that every Jew had a right to enter Palestine, that Jews must take the initiative against Arabs to deter their attacks, and that Jewish armed force alone, not collaboration with the British, would bring about the desired Jewish homeland in all of Palestine.

Begin absorbed these principles during his upbringing in Poland and they remained with him throughout his political life, transformed to meet changing historical circumstance, but never abandoned.

There were other political and personal traits that can be traced to these crucial years of his life.

Tempered by the conspiratorial nature of Jewish politics in late 19th and early 20th century Eastern Europe, Begin early on displayed a fierce determination to stand fast to what he believed to be right. The prospect of tactical gain seldom brought a display of flexibility. Strong argument in favor of conflicting views of what might constitute right usually met with sharp rebuff.

It was a determination his political foes and diplomatic adversaries in the Middle East and at the State Department encountered time and time again. Since his views often were extreme, the result was an unusual degree of friction and strained relationships.

The word "concession" did not seem to be a part of Begin's vocabulary. Following Sadat's visit to Jerualem, Begin told an interviewer: "You are not supposed to begin negotiations with concessions. You start with differences of opinion and you narrow them down. Sadat and I know what our differences are, and we are prepared to negotiate an accord."

As his foes time and again ran up against his fierce determination, there were frequent reminders of his intense desire to set straight his version of history and his equally intense belief that history and morality stood him in the right.

His years in political opposition that began with the formation of the Herut (Freedom) Party after independence only reinforced an image of a man who could demonstrate the politician's adeptness at feinting, but who, on basic strategic principles, steadfastly followed the same political course throughout his life.

For all those long years, when he and his party were mocked as a lunatic fringe, he did not modify his principles for political expediency. When his strident opposition to a reparations settlement with West Germany sparked rioting, he was portrayed as a seditionist; yet he did not swerve. During the 1977 campaign, when he might have tried to broaden his appeal by projecting a more moderate image, he stayed with his bedrock principles, and he won.

Through it all he developed a reputation as a fierce parliamentary debater, weaving Yiddish jokes into impassioned arguments, cutting through obfuscation, charming with self-deprecation, always injecting an awesome sense of Jewish history into his case.

It was only in the past few months, following the death of Aliza, his wife of more than four decades, that Begin appeared to lose the quickness of wit and sharpness of mind and tongue that had allowed him to master both the raucousness of the Israeli parliament and the fractious nature of his Cabinet. It was as if his personal will to forge ahead suddenly had withered even if the political will remained strong.

Before becoming prime minister, Begin had only once been brought into an Israeli government. Just before the start of the 1967 war he was made minister without portfolio in what was intended as a national unity government. He resigned three years later to protest Israel's acceptance of a U.S. proposal that called for withdrawal from the occupied territories.

Shortly before his dramatic rise to the premiership, Begin visited the stony, inhospitable Samarian hills in the West Bank to celebrate the installation of a Torah scroll at the settlement of Elon Moreh.

"We stand on the land of liberated Israel. There will be many, many Elon Morehs," Begin declared. Then, chiding reporters for their questions about his intentions, he said, "We don't use the word annexation. You annex foreign land, not your own country."

From 1967 to 1976, Israel had established 10 settlements in the West Bank. In the first six years of Begin's government, 62 new settlements were established.

In contrast to settlements in the Sinai, which he defended tactically but ultimately ordered disbanded as part of his agreement with Sadat, Begin showed no inclination to back away from his belief that Israel had a historical and legal claim to the West Bank, a claim that became underscored by an increasing Jewish presence.

There were other sharp retorts, reminiscent of the barbed language he used in his years on the opposition benches, some aimed at the United States, some at Western European countries, some at American Jews who became disenchanted with many of his policies following the 1982 invasion of Lebanon and siege of Beirut.

Each outburst of fierce nationalist rhetoric was accompanied by references to the history of the Jews or of the target of the latest rhetorical attack. Just as the Irgun, the anti-British guerrilla organization headed by Begin in the 1940s that often used terrorist measures, refused to adopt a defensive posture during preindependence days, so did Menachem Begin remain always on the offensive as prime minister.

The pattern of hard-nosed negotiation was set at the beginning in his dealings with Sadat. The euphoria that set in with Sadat's trip to Jerusalem in November 1977 quickly met head-on with Begin's refusal to budge on the West Bank or on dealing with the Palestinians. It was a posture that eventually took Begin, Sadat and Carter to Camp David and tense negotiations that, by Carter's account, barely escaped ending in disaster.

When it was over, Carter and Sadat could claim to have laid what at best could be called a veneer over a continuing discord on these critical issues. Even that was clouded for months by a tendentious debate over the issue of Israeli settlements. Three and a half years later, long after Egypt and Israel had established diplomatic relations, President Reagan called in 1982 for an end to Israeli settlement activity on the West Bank as a first step toward picking up where Camp David had left off.

In between, Begin rarely enjoyed a moment of calm as his West Bank policy of increasing not only the number of Jewish settlers but also the degree of Israeli control over its majority residents, was met with growing restiveness by the Arab population, which, in turn, led to clashes with settlers, security forces or both.

In the north and along the coast, there was a drumbeat of terrorist raids accompanied by the new menace of long-range rockets and artillery, fired from southern Lebanon. Begin's government responded with land, air and sea attacks against the Palestinians based in Lebanon and increased the level of support for Lebanese Christians. Tensions with Syria increased both over Lebanon and over Israel's formal annexation of the Golan Heights, captured in the 1967 war.

The turmoil on the borders was accompanied by trouble at home. Inflation continued unabated and the Cabinet suffered two major defections in foreign minister Moshe Dayan and defense minister Ezer Weizman. Then Begin suffered a minor stroke and a heart attack. Yet, he repeatedly turned aside no-confidence motions with ease and the public opinion polls showed him easily in command.

If anything, the departure of such powerful personalities as Dayan and Weizman with barely a whimper demonstrated Begin's political dominance. Behind the facade of Cabinet chaos, he unquestionably was in control.

Labor, with lackluster leadership, floundered as Begin, the European outsider, played to the emotions and the patriarchal beliefs of the growing Oriental population. It was a population that had no direct memory of the Holocaust, but plenty of memories of troubles as a minority in predominantly Moslem lands.

For all the drama and conflict of the first years of Begin's time in power, 1982 provided even more.

First came the final withdrawal of Israeli forces from the Sinai, accompanied by traumatic scenes of Israeli troops dragging Israeli settlers from the last settlements in occupied Egyptian territory. Begin proved as firm in keeping an agreement once made as he had been tough in reaching the accord at the outset.

Then, within weeks of leaving the Sinai, Israeli troops launched a massive invasion of Lebanon. Following an assassination attempt against the Israeli ambassador in London, the government said it was moving to crush the military structure of the Palestine Liberation Organization in southern Lebanon and bring an end to the danger facing northern Israel.

But the Israelis did not stop in the south, and moved rapidly for Beirut, laying siege to the city and in the process delivering a devastating blow to Syrian forces in the Bekaa Valley and to the Syrian Air Force that tried to protect them as well as to the fighting arm of the PLO.

By his actions in Lebanon, Begin fundamentally changed the dynamics of power relationships in the Middle East, changing, with perhaps unforeseen consequences, the perception of Israel as a beleaguered nation.

Perhaps in his mind it was the greatest legacy this ultimate survivor could leave. He had, after all, survived the Nazis, survived the Russian camps, survived the British manhunts, survived the years in opposition and survived as head of a fractious coalition government--survived and, some would say, grew stronger with each passing test.

Those who met and observed him say Begin seemed to identify his survival with that of the Jews as a people and that he steadfastly kept that single goal before him, regardless of how history might judge him or his actions. All else was secondary.

Yet, the inability to bring the troops home from Lebanon also began to weigh more and more heavily on him as the death toll mounted, eventually passing 500--all the more so as he clearly failed to recover from his wife's death.

It really should have been no surprise, then, when Begin suddenly announced that he had decided to step aside as prime minister. He always had said he would leave office when he turned 70 and he celebrated his 70th birthday on Aug. 16. On Aug. 28, he told his Cabinet colleagues his tenure was over.