JERUSALEM — Israel’s defense minister, Ehud Barak, abruptly announced Monday that he will quit politics, potentially depriving Prime Minister Benjamin Netanyahu of a key ally who enabled his hard-line government to present a moderate face to the world.
Barring another comeback by the mercurial former general, Barak’s departure marked an end to a distinguished and tumultuous career that spanned half a century. It began on a communal farm, led to military greatness and business success and a mixed record in politics that was highlighted by failed peacemaking efforts during a brief term as prime minister.
Despite polls showing his small centrist Independence Party gaining momentum after the eight-day Israeli offensive in Gaza that he steered, Barak said he would not run again for office in the Jan. 22 elections.
‘‘I feel I have exhausted my political activity, which had never been a special object of desire for me,’’ Barak, 70, said in Tel Aviv. ‘‘There are many ways for me to serve the country and society, not just through politics.’’
Barak will remain as defense minister until a new government is sworn in after the elections. Still, analysts predicted that Israel’s most prominent warrior-statesman of his generation had yet to say the last word and was perhaps still angling to keep his job after the election as a special appointment of Netanyahu, who is expected to be reelected.
In recent polls, Barak’s party had been struggling to nudge above the electoral threshold needed to get into Parliament.
‘‘In his position, he did the smartest thing one could do,’’ said Shlomo Avineri, a political science professor at Jerusalem’s Hebrew University. ‘‘He’s not as popular as an electoral candidate as he is a minister of defense. He’s not going to say no if he’s asked to be the next minister of defense. And he probably will.’’
Over the past four years, Barak gave Netanyahu’s governing coalition a well-known face to deal with the international community and Netanyahu himself a loyal and seasoned partner.
The two men have been close since the 1970s, when Barak was Netanyahu’s commander in the elite Sayeret Matkal commando unit. As prime minister, Netanyahu awarded Barak great influence in decision-making and made him his informal point man to the United States.
The Obama administration embraced him as a moderating influence on Netanyahu’s hard-line policies toward the Arab world and Iran’s nuclear program. Barak was scheduled to leave Tuesday for meetings with US officials in Washington.
His departure from politics comes at an uncertain time for Israel, with Islamist political parties rising around the Jewish state and a decision looming on whether to strike Iran’s nuclear program.
The Netanyahu-Barak alliance had its strains over this issue — with the prime minister reportedly objecting to Barak’s newly moderate position that Israel should defer to the United States in deciding whether to attack Iran should sanctions fail to deter Tehran from attaining a nuclear bomb.
Netanyahu’s hawkish vice premier, Moshe Yaalon, is expected to become defense minister if Barak remains on the sidelines.
In a statement, Netanyahu did not reveal his hand, saying only he ‘‘respects’’ Barak’s decision to retire and thanking him for ‘‘his contribution — over many years — to the security of the state.’’
A protege of the assassinated Prime Minister Yitzhak Rabin, another former chief of staff, Barak was groomed for greatness. Born Ehud Brog, the eldest of four sons to Eastern European immigrants, he changed his name in the military to Barak (Hebrew for lightning).
He became Israel’s most-decorated soldier, collecting medals and citations at a historic pace for his heroics on the battlefield and for leading daring commando raids.
As commander of Sayeret Matkal, Barak led the 1972 raid on a hijacked Sabena airliner on the ground in Israel with the commandos disguised as airline technicians. The next year, he led a commando operation in Beirut, sneaking into the city disguised as a woman.
Renowned as a brilliant military strategist, he rose through the ranks to become military chief of staff. In 1995, after 36 years in uniform, he made the quick transition to politics.
In less than four years, Barak was elected to Parliament, held two top Cabinet posts, took charge of Israel’s Labor Party, and was elected prime minister in 1999, on a pledge to reach a long-awaited peace with Israel’s enemies.
But his stormy term in office lasted less than two years — the shortest of any elected Israeli premier — and he left under a swell of discontent for his unilateral withdrawal from south Lebanon in 2000, his failed negotiations with the Palestinians and Syria, and a violent Palestinian uprising that erupted under his watch.
Despite the dramatic collapse, Barak credited his wide-reaching offer at Camp David to withdraw from nearly all of the West Bank and Gaza with exposing Palestinian leader Yasser Arafat’s essential rejection of peace.