The "Haganah" replaced the "Shomrim" as the official under-ground army of the Yishuv (the Jewish community of Palestine).
In 1920, the shomrim organization was replaced by the Haganah -- becoming the official underground army of the Jews in Palestine. The Haganah was initially established under the direct control of the Achdut Avodah party. However, with the establishment of the Histadrut, the Haganah came under its direct oversight. The Haganah's first actions were conducted in response to the 1920 Arab riots in Jerusalem.
During subsequent riots in 1921, the Haganah performed commendably in Jerusalem, but struggled to effectively manage the disturbances in Jaffa. In the relatively peaceful period in Palestine, from 1921 to 1929, the Haganah stagnated. The 1929 riots caught the Haganah by surprise. Although the Haganah was able to defend Jewish settlements against attack in most instances, it could not prevent the massacres that took place in Hebron and Safed. Following these riots, the Haganah underwent a reorganization, significantly boosting both the import and local manufacture of arms.
In 1931, non-Histadrut elements of the Haganah seceded and formed their own group. The 1936 riots resulted in another reorganization that put the Haganah under the direct control of the World Zionist Organization, and the splinter faction rejoined.
The 1936 riots accelerated the growth of the Haganah. During the initial stage of the riots, the Haganah was able to successfully defend each and every Jewish settlement so that none needed to be abandoned. By the end of 1936, the Haganah had formed highly capable mobile units that were able to take the offensive against Arab attackers. In 1937, the British decided that in order to maintain order during the Arab revolt, they would have to cooperate with the Jewish community. Thus, they organized a legal Jewish police force, which was essentially under the control of the Haganah. This force grew to include over 1,000 full-time members and 22,000 militia members.
In 1938, the British Army authorized Captain Orde Wingate to organize special “Night Squads.” Their night attacks were a major element in successfully suppressing the Arab revolt. With the British issuance of the White Paper, the Haganah began to concentrate on illegal immigration. With the outbreak of World War II, the Haganah once again began large-scale cooperation with the British, encouraging many of its members to join the British Armed Forces. At war's end, the Haganah concentrated its efforts once more on smuggling illegal immigrants into Palestine, as well as preparing the way for independence. When Israel's independence was declared, the Haganah became the Israel Defense Forces.