After the elections of July 23, 1984 neither of the big parties had enough seats to form a government and a National Unity Government was formed. Under the terms of the agreement between the Labor Party and Likud, Shimon Peres served for the first two years as prime minister before handing over the baton to Yitzhak Shamir. Peres appointed Rabin as Defense Minister and Shamir kept him in the job until the end of the third National Unity Government he headed, in 1990.
During his term as Defense Minister, Rabin worked for a staged IDF withdrawal from Lebanon and entrenched the IDF's control of the security zone. Contrary to all his predecessors, Rabin agreed to a cut in the defense budget, a move that was made possible by Egypt's withdrawal from the circle of conflict. His agreement to the "Jibril prisoner swap" in which 1,150 Palestinian prisoners were exchanged for the release of three Israeli soldiers, caused great public controversy, but responsibility for the lives of the Israeli prisoners tipped the scales in favor of the deal.
When the Intifada broke out Rabin at first failed to recognize its singularity. For the first months Rabin believed that there was a military solution to the popular uprising and tried to suppress it by force. His policies appeared immoral and ineffective to the left, and insufficient to the right. After a few months of fighting he was persuaded that the uprising reflected authentic Palestinian national aspirations that Israel could no longer ignore. The Palestinians' willingness to accept casualties caught him by surprise and led to the recognition that a policy of force alone would not lead to calm. Rabin was aware of the growth of a local Palestinian leadership and for the first time saw it as a partner for negotiations. Meanwhile, fears were growing of the influence of the Intifada on the IDF's esprit de corps and on its standing as the people's army.
In 1989 Rabin formulated a two-stage peace agreement in which he proposed that elections be allowed in the territories to choose a local leadership that would manage the Palestinian autonomy agreed upon in the Camp David Accords, and ensure calm in the territories. The second stage of the initiative was to be negotiations with the elected leadership over a permanent status agreement. Under American pressure the plan received the support of Prime Minister Yitzhak Shamir.
In 1990, the National Unity Government collapsed and the Labor Party returned to opposition.