He was the son of Sayyad Abdul Wahhab al-Gaylani and born into the prominent Baghdad-based Gaylani family. The Gaylani were known as sadeh, as they were from a family that traced its ancestry back to the Islamic prophet Muhammad. Rashid Ali enrolled in law school in Baghdad and was a lawyer until his political career.
In 1924, Rashid Ali al-Gaylani began his career in politics in the first government led by Prime Minister Yasin al-Hashimi. Yasin al-Hashimi appointed Gaylani as the Minister of Justice. The two men were ardent nationalists and were opposed to any British involvement in the internal politics of Iraq. They rejected the Anglo-Iraqi Treaty signed by the government of Prime Minister Nuri as-Said in 1930. They formed the Party of National Brotherhood to promote nationalist aims. Gaylani served as Prime Minister for the first time in 1933 but held office for less than eight months. In 1938 the subject was seized and exiled to 'Ana for his suspected role in the Baghdad bomb-throwing of November and the general political upheaval.
During the Hashimi government, the subject served as Minister of Interior with the additional benefit of the lucrative trusteeship of the Qadiri Awqaf. Later. as prme minister, he would retain the interior portfolio as public works projects progressed, including the laying of the foundations for a mosque to be named, the Faysal Mosque.
On 31 March 1940, when Gaylani was again appointed Prime Minister, World War II had started and Iraq had just experienced the premature death of King Ghazi. Ghazi's reign was followed by a Regency for his four-year-old son who was now the new King Faisal II. Faisal's Regent was Ghazi's uncle, Emir Abdul-Illah. Abdul-Illah supported Britain in the war, but he was unable to control Gaylani, who used the war to further his own nationalist goals by refusing to allow Allied troops passage through Iraq to the front. He also rejected calls for Iraq to break its ties with Fascist Italy and sent his Justice Minister, Naji Shawkat, to Ankara to meet with Germany's ambassador to Turkey, Franz von Papen, to win German support for his government. German Foreign Ministry archives record that Shawkat met von Papen on July 5, 1940, and he carried a letter of introduction from Mohammad Amin al-Husayni, the Grand Mufti of Jerusalem, expressing a desire for a treaty of friendship and collaboration. Baghdad was the early base for Nazi Middle East intelligence operations during World War II.
Britain responded with severe economic sanctions against Iraq. Meanwhile, news of British victories against Italian forces in North Africa dulled support for Gaylani's government, and, on 31 January 1941, under pressure from Regent Abdul-Illah, he resigned his post as Prime Minister. This only exacerbated his mistrust of Britain and its supporters in the government. Together with the members of the Golden Square, Gaylani made plans to assassinate Regent Abdul-Illah and seize power. On 31 March, Abdul Illah discovered the plot to assassinate him and fled the country.
On April 1, the coup d'état was launched and on April 3, Gaylani returned to power as Prime Minister and his "National Defence Government" replaced the government of the Regent. As one of his first acts, Gaylani sent an Iraqi artillery force to confront the RAF base situated in Habbaniya, RAF Habbaniya. By the end of April, the Iraqi armed forces were situated in strong positions on the escarpment above the base, and a siege began.
Iraq had been a major supplier of petroleum to the Allied war effort and represented an important landbridge between British forces in Egypt and India. To secure Iraq, Prime Minister Winston Churchill ordered General Archibald Wavell to protect the air base at Habbaniya. On 18 April, British forces from India landed in Basra, Sabine Force. In the British Mandate of Palestine, another force was created to enter Iraq from the west and relieve RAF Habbaniya, Habbaniya Force.
At Habbaniya, the besieging Iraqis demanded the cessation of all training activities and of all flights in and out of the base. On 2 May, the commander at RAF Habbaniya, Air Vice-Marshal Harry George Smart, responded to the Iraqi demands by launching a pre-emptive strike against the Iraqi forces overlooking the air base. This action initiated the Anglo-Iraqi War. Within a week, the Iraqis abandoned the escarpment. By mid-May, British forces from Habbaniya had moved on to Fallujah and, after overcoming Iraqi resistance there, moved on to Baghdad. On 29 May, fearing a British onslaught, Gaylani fled to Iran. Before he left Baghdad, Gaylani contacted Mulla Effendi and informed him that he had chosen his house as a safe haven for the royal family to stay until the conflict ended.
On 31 May, an armistice between the British and the Iraqis was signed. On 1 June, the Regent returned to Baghdad and his government was restored. Immediately afterwards, a violent pogrom against Jews took place in Baghdad by the hands of former Gaylani supporters.
Gaylani was not to stay long in Iran. On 25 August 1941, British and Soviet forces invaded Iran and removed Reza Shah from power. Gaylani then fled to German-occupied Europe. In Berlin, he was received by German dictator Adolf Hitler, and he was recognized as the leader of the Iraqi government in exile. Upon the defeat of Germany, Gaylani again fled and found refuge, this time in Saudi Arabia.
Gaylani did not return from exile until after the revolution that overthrew the Iraqi monarchy, in 1958. Once again, he attempted to seize power; he plotted a revolt against Abdul Karim Kassem's government. The revolt was foiled and Gaylani was sentenced to death.
Later pardoned, he returned to exile in Beirut, Lebanon, where he died in 1965.