In 28 May 1918, the Azerbaijani National Council declared the formation of the independent Azerbaijani Democratic Republic (ADR). The National Council was established a day earlier in Tbilisi consisted of the Azeri members of the recently dissolved Transcaucasian Sejm. The first urgent task of the newly formed Azerbaijani government was to return to the territories it claimed to rule. However, a big portion of these territories, including the capital city Baku, were under control of the other rival factions of the enraged civil war in Russia. For the sake of the survival of the formally declared ADR, liberation of Baku from the Bolsheviks, who took over the control of the city after launching wide scale massacre of local Muslim population in March 1918, was an existential matter. Both domestic and international developments around Azerbaijan in the summer of 1918 required urgent actions. In June, the Azerbaijani Government moved from Georgian capital Tbilisi to Ganja city of Azerbaijan.

Meanwhile, on 12 June 1918, a few days before the arrival of the Azerbaijani government to Ganja, the head of the Baku Soviet and prominent Bolshevik revolutionary of Armenian descent Stephan Shaumyan sent a telegram to Vladimir Lenin and Joseph Stalin in order to seek their approval to launch a march of Baku Soviets’ military units on Ganja. However, the military attack launched by the Baku Soviet of People’s Commissars to take over Ganja city failed. On the other hand, a couple of weeks before arriving in Ganja, that is on June 4, the Azerbaijani National Government signed a treaty with the Ottoman Empire. According to this agreement, the Islamic Army of the Caucasus (IAC), composed of Ottoman regular army units under Nuri Pasha and Azerbaijani cavalry regiments of former tsarist Army under the command of general Shikhlinskiy, started their preparations for a campaign to take over Baku from the Baku Soviet. The campaign started on 19 June 1918.

Yet Germany, the main ally of the Ottomans, was not pleased with the signing of a friendship agreement between Azerbaijanis and the Turks. The German embassy in Istanbul informed Berlin that the Turks signed a treaty with the Tatar section of the Caucasus and this was not the first time that the Turks unilaterally called this part of the Caucasus Azerbaijan. Despite the objection of the Germans, on 23 June 1918, a martial law was declared in all territories of Azerbaijan by the Azerbaijani national government which was supported by the IAC. The German regiments under the command of General Friedrich Freiherr Kress von Kressenstein, who was sent to Georgia after his defeat to the British armies in the Middle East, attempted to halt the movement of the IAC towards Baku, however his officers were immediately imprisoned by the Turks. On 24 June 1918, Istanbul issued an instruction that there could be no army other than that of the Ottoman’s in the territories of Azerbaijan.

The first major battle between the Bolsheviks and their allies that is the Armenian military units loyal to Dashnak Party, on one side, and the IAC on other side took place between 27 June 1918 and 1 July 1918 in the Goychay-Garameryam front. Military operations ended with disastrous defeat of the troops of the Baku Soviet. All attempts made by the Bolshevik commander Petrov and his regiment of about a thousand people, which was sent from Petrograd, to stop the fleeing soldiers of Baku Soviet from battlefield failed. Moreover, Petrov was outraged by the atrocities committed by the joined Bolshevik-Armenian units against the local Muslims. He complained to the Central Government of Russia in Petrograd that amid this chaos he was not sure whether he was fighting for the noble cause of revolution because he was feeling that he was an ally of thugs.

On 20 July 1918, the IAC liberated Shamakhi, former capital of medieval Shirvanshah Kingdom. The city had a strategic importance for the troops advancing towards Baku. The Muslim population of the city cheered the Ottoman troops because earlier it heavily suffered from atrocities committed by Armenian troops sent by the Baku Soviet.

Yet the liberation of Baku by the IAC, which swiftly liberated Shamakhi and landed on the outskirts of Baku, was delayed due to attempts of the Soviet Russia’s leadership to stop the Turks by using the assistance of Germany against their Ottoman ally. The report of the German Embassy in Istanbul dated in early July of 1918 said: “If we will be able to reach an agreement with the Bolsheviks, all Baku oil fields and oil reserves will remain intact in our control. In contrast, if the Bolsheviks are forced to leave the city, they will burn the oil fields and, in that case, neither us, nor the Turks will be able to use oil reserves of Baku.” General Erich Ludendorff was personally involved in the matter to prevent the Turks from active military operations. He threatened Enver Pasha that all the German officers serving in the Turkish army would be recalled if the attack on Baku was not halted.

Although in his official orders Enver Pasha instructed the IAC to stop the attack, on a secret telegraph, he informed the leadership of the IAC that he had sent the 38th Infantry regiment and one artillery tabor through Qazakh as reinforcement to Nuru Pasha who was in preparation to take Baku. Enver even did not exclude the possibility that the IAC could enter into military confrontation with the German troops, in case they would try to block the Ottoman troops from taking Baku.

Soviet Russia, hoping to turn the “Azerbaijani issue” into its internal affair, assumed that the Turkish-Azerbaijani troops would be withdrawn under the German pressure. In his letter on 8 July 1918, Stalin advised Shaumyan that he should avoid provoking the Germans that the Baku Soviet should not go beyond Elisabethpol (Ganja) and should avoid from entering Georgia of which independence had already been recognized by Germany. Stalin wrote: “Perhaps we can make a concession to the Germans in the Georgian issue but we can only make this concession on the condition that Germany guarantees that it will not interfere with us in the Armenian and Azerbaijani issues.”

The defeat of the Goychay-Garameryam battle brought closer the end of the joint Bolshevik-Dashnak troops. So, in order to defend Baku, the Soviets even sought and reached agreement with their former foe Colonel Lazar Bicherakhov, the commander of the Russian Cossack Regiment in Iran who was the fierce enemy of the Soviets. The Baku Soviet invited him to the Baku front. For the purpose of preventing the movement of the IAC, Bicherakhov’s Cossack regiment came from Anzali on 5 July 1918 and arrived at the front line two days later. The non-Muslim Baku press called him a savior and dubbed him a “little Napoleon.” The exaggerated rumors about bravery of Bicherakhov circulated in the streets of Baku. Sympathizer local non-Muslim youth had their haircuts similar to Bicherakhov. Nevertheless, when the “savior” became acquainted with the desperate situation in the front line, he immediately left the city and quietly moved towards the north, later entering Dagestan.

Departure of Bicherakhov further exacerbated the situation of the Baku Bolsheviks. On 24 July 1918, the Eser-Menshevik-Dashnak block made its first attempt to seize power in Baku from the Bolsheviks. The block offered to ask the British army stationed in Anzali, which was waiting for the invitation, to come and defend the city from the advancing IAC. On 30 July 1918, Colonel Avetisov, one of the leaders of the Baku Commune’s army, informed the city Soviet that the continuation of the resistance was meaningless. A day later, when the Turks seized the Shikh highlands and Bibi-Heybat district in the outskirts of the city, Baku Soviet’s government led by Bolshevik Shaumyan resigned and the commissars departed to Astrakhan by ship.

The same evening, on 31 July 1918, Prime Minister of Azerbaijan Fatali Khan Khoyski wrote to M. A. Rasulzade, the head of Azerbaijani delegation in Istanbul, that “two days ago, Muhammad Hasan Hajinski went to the front line and tonight I will go there, too. Our army has arrived in Baku and seized Gobu, Khirdalan, and Sumgait districts. The major army is between Hajigabul and Alat along the railway, and I hope that if there is no interrupting emergency, we will take Baku soon.”

However, before the Bolsheviks left the city, a new government called “Central Caspian Dictatorship and the Presidium of the Soviet Temporary Executive Committee” was formed under the joint control of the Armenian National Council, the Dashnaks, and the Mensheviks. The first step of the Central Caspian Dictatorship was to stop the fleeing commissars near Nargin island and return them to the city. At the same time, the Central Caspian Dictatorship invited the British to Baku “for the sake of saving Baku for Russia.”

The overthrow of the Baku Soviet of People’s Commissars was welcomed by the Azerbaijani government as an important event. This event resulted in the withdrawal of the representatives of Germany and Austria in the South Caucasus from their previous positions on the Baku issue. On this occasion Khoyski wrote to Rasulzade:  “I would like to inform that the Bolshevik government of Baku has been overthrown. Commissars have been arrested. Part of the oil fields and all the Absheron peninsula are under our control. We are confident that the city will soon be liberated. The heads of the German and Austrian missions have repeatedly assured us that they recognize Baku as an integral part and the capital of Azerbaijan. Now they are even helping us in the transportation of the military units.” Unlike General Ludendorff, General Hans von Seeckt, the head of the Turkish army headquarters, was able to convince Berlin not to hamper the liberation of Baku by the IAC. On 2 August 1918 and 3 August 1918, the Turkish and the Azerbaijani armies tried to enter the city from various directions. Meanwhile, the Bolsheviks, who were still in the besieged shore, offered their assistance to the Central Caspian Dictatorship. This suggestion was accepted and their joint resistance halted the advancing Ottoman-Azeri military.

Meanwhile, the first British group consisting of 240 people, under the command of Colonel Stokes, had already arrived in Baku. Shortly afterwards, between 9 August 1918 and 17 August 1918, about a thousand British troops, that is the British Military Mission to the Caucasus, known as “Dunsterforce” and named after its commander Major-General Lionel C. Dunsterville, consisting of three battalions, a desert artillery battery and a few armored vehicles, entered Baku. Because the Turks captured the heights around the city, General Dunsterville preferred to spend the night on the “Admiral Kruger” ship with which he came from Anzali, rather than in the residence allocated to him by the Central Caspian Dictatorship. The small size of the British troops frustrated everyone. Therefore, in order to raise the moral of local non-Muslim population of Baku, in the evenings, two or three hundred British soldiers were sent to ships and in the morning they were brought back as new forces. After familiarizing himself with the military situation in the city, Dunsterville admitted to the Central Caspian Leadership that Baku could not be defended under the attacks of the Turks. Tyushkov, one of the fleet officers of the Central Caspian Dictatorship, who learnt that the British wanted to leave, threatened them that any ship sailing from the coast to the sea would be fired. In a sense, the British, who were impatiently waiting for the last attack of the Turks, became hostages of the Central Caspian government. Tyushkov confessed that the vast majority of Muslims remaining in the city after the March massacre were looking forward to seeing the city captured by the advancing Turkish-Azeri troops.

In the beginning of August, the IAC further narrowed down the siege chain of Baku. On 8 August 1918, the ultimatum of the IAC was published in the press of the Dictatorship. Two days later, some villages of Absheron peninsula rebelled against the Central Caspian Dictatorship. Soon Mashtaga was liberated by the IAC. However, in mid-August, the information sent to the Ministry of Foreign Affairs of Azerbaijani Republic from its delegation in Istanbul clearly indicated that the Germans were once again trying to prevent the Turks from launching the final push. Rasulzade wrote: “On [August] 17th, I was with Enver Pasha and the Minister of Foreign Affairs. A day before I personally met with Talat Pasha. The problem is that the Germans protest against the Turkish army’s advancement into the Caucasus and, especially, they demand that the Turks stop their march towards Baku. They are cautioned that when the Bolsheviks retreat, they would burn the oil fields repeating the steps of the British who destroyed the oil reserves in Romania. Thus, the Germans prefer to settle the issue peacefully. They revived their previous view and once they were ready to recognize the independence of Baku, which would also include its surroundings, plus Shamakhi and Salyan districts. These intentions were resolutely rejected by the Turks.” In his letter written on 19 August 1918, General von Seeckt was urging the German General Staff as well as General Ludendorff that the arrival of the British in Baku changed the situation, that now, with the rapid attack by the Turks, the destruction of oil fields could be prevented. He delivered the promise of Enver Pasha to Berlin that “if we capture the city quickly, there will be less possibility for the destruction of oil fields.” Seeckt added that he shared the view of Enver and the Turks should be supported in capturing the city as soon as possible.

Following the appearance of the British in Baku, on 17 August 1918, Enver Pasha himself also sent a telegram to Berlin, indicating that Baku should be urgently taken with the help of the German military units. In the second decade of August, there were intense correspondences between the Ottoman Ministry of Defense and the German General Staff on the issue of Baku. Yet the German Foreign Ministry disagreed with formulation of the problem. Baron Bergheim, the representative of the Ministry, warned that they should take into consideration that the British may decide to stay in Baku for the foreseeing future. Therefore, he reiterated his view that the Ottomans and the Soviet Russia should collaborate in the issue of Baku: the city, according to him, should remain under the Russian control. There should be such an administration in Baku which would ensure the supply of oil to Germany and Russia by also taking into account the needs of the Ottomans. He believed that the longer the agreement on this issue is postponed, the more the British would strengthen their power in Baku. Adolph Abramovich Joffe, the Soviet temporary attorney in Berlin, informed the German Foreign Ministry that although his country strongly opposed the entrance of the Turks to Baku, the Soviet Union would not consider it a “non-friendly” act if Germany removed the British from Baku and temporarily take control of the city; however, with the condition that in the future Baku would be returned to the Soviet Russia. The German Foreign Ministry rejected the idea of joint administration in Baku. The German Foreign Minister Paul von Hintze notified the German Chancellor that according to the Supreme Military Command, Baku should remain in the hands of the Russians, and the advancements of the Turks should be resisted by all means; and Germany should try to reach agreement with the Soviet Russia on the issue of oil supplies. On 18 August 1918, Ludendorff confirmed that he was pleased with these proposals. This decision was reflected in a secret agreement signed on 27 August 1918 between the Soviet Russia and Germany. However, Turkish Prime Minister Talat Pasha, who visited Berlin several days after the deal, clearly let his counterparts in his negotiations in the German capital know that Baku belonged to Azerbaijan. After correspondences with the Azeri Prime Minister Khoyski, as well as Akaki Chkhenkeli, the Minister of Foreign Affairs of Georgia, Frederic-Hans von Rosenberg told the German government that Azerbaijan, which had been supported by Ottomans and Georgia, had enough power to liberate Baku.

In the middle of August, Enver Pasha sent similar notifications to Nuru Pasha as well. He stated that the negotiations with Germany did not produce serious results because the Germans were persistent that the Brest-Litovsk treaty should be maintained and peace with the Russians should not be put at risk. Enver Pasha wrote: “Although the Germans do not want to put Baku under the control of the Azerbaijanis, we claim and insist that the newly formed Azerbaijani government cannot live without Baku.” In those days, the urgent dispatch by Rasulzade in Istanbul, to Muhammad Hasan Hajinski, the then Foreign Minister of the Republic, was emphasizing the need for accelerating the liberation of Baku. According to him “if Germany is defeated on the Western front in the summer campaigns of 1918 it could substantially change the international situation”. Rasulzade closely acquainted himself with the course of the events and had seen their possible political consequences. He stated: “No matter what it takes, Baku should be liberated as soon as possible. Otherwise, the situation on the ground could be used against us as a matter of fact and we would face serious difficulties. The advancement towards Baku should be carried out under the banners and for the cause of Azerbaijan only. For the city should be captured by Azerbaijani government. Otherwise, difficult problems may arise.” After analyzing the events in the international arena, Rasulzade notified the Azerbaijani government that “you have to capture Baku so that everybody faces its control by our government as a matter of fact.” Prime Minister Khoyski, in turn, asked Rasulzade to increase his diplomatic efforts in Istanbul concerning the liberation of Baku. He wrote that “as the most important problem, Baku issue has yet to be solved and we do not know whether there will be a solution soon. You must use all your influence to achieve a quick solution to this issue in Istanbul, otherwise later it could be impossible. The British have already appeared in Baku with two thousand soldiers equipped with all the technical means. The situation is getting worse every day. Andronik’s (Armenian military commander) army, which has occupied part of Zangezur district from the direction of Karabakh, wants to separate Shusha district from us. Unless we solve the Baku issue, we are not capable of doing something else.”

On 26 August 1918, an attack of the Ottoman army against Baku began from the direction of famous Mud volcanoes. The British were routed there and their relatively small sized military units suffered serious casualties. On 31 August 1918, Binagadi, Digah, and Mahammadli villages in the outskirts of Baku fell under control of the IAC. In those days, General Dunsterville, who was angry at his local allies, desperately wrote: “I thought that since there was no way out of the present circumstances, to what extent I have a right to put so many people at risk? These revolutionaries and their committees were not useful for anything other than just speaking at meetings. When they went to frontline, their battalions held meeting; and when the situation worsened, they left the battlefield and escaped to the city again.”

At the beginning of September, the change of the international situation in favor of the Triple Entente weakened the interest of Germany to the agreement of 27 August 1918. In the autumn of 1918, in the letters and telegrams sent from Istanbul, the representatives of Azerbaijan emphasized that the political situation had changed and they believed that under this new complicated conditions an immediate release of Baku was urgently required. Enver Pasha mentioned at the meeting with the Azerbaijani representatives that the arrival of the British troops in Baku made the German resistance to the liberation of the Azerbaijani capital meaningless. Rasulzade warned from Istanbul that “the Baku issue is only dependent on military force. If Baku is not captured, everything is over. Goodbye, Azerbaijan. Even after its capture, we will face many diplomatic challenges. In order to accomplish this task, we have to prepare the army in advance. The public opinion and political circles in the Ottoman Empire are quite concerned about this issue.” On 10 September 1918, German General Staff, seeing that the liberation of Baku is inevitable, ordered General von Kressenstein, commander of the German military units in Georgia, that they should be prepared for the seizure of Baku and he should notify Berlin when the operation was ready. Only then General von Kressenstein would receive an order to execute the operation and he should had noted that this plan would be carried out directly by the German armies. If it would be beneficial, the letter continued, the Ottoman and the Azerbaijani military could also be involved in the operation. Nevertheless, while the Germans had correspondences, the final date of the liberation of Baku had already been approved in Istanbul and the IAC had received the order: On 15 September 1918, Muslims must celebrate their holy Qurban bayramı (Eid-Al Adha) holiday in their own city.

After a serious military and diplomatic training in the summer and autumn of 1918, a decisive attack on Baku began. On 15 September 1918, the British troops left Baku. Even though the leaders of the Central Caspian Dictatorship threatened Dunsterville that his ship will be fired by the Baku artillery, it was too late. A part of the Armenian forces under the Armenian Military Commissar General Jaques Bagratuni fled to Iranian Anzali as well. The leadership of the Baku Soviet of People’s Commissars, arrested earlier by the Central Caspian Dictatorship, was released by Bolshevik Anastas Mikoyan with the assistance of Abram Veluns, one of the government officials of the Dictatorship. The released commissars left Baku. After the last battle, which lasted 30 hours, the Azerbaijani military units entered Baku on 15 September 1918. Muhammad Amin Rasulzade expressed his joy with following words: “After sufferings of the last six months, finally Muslims are in a good mood. On a happy day, like Qurban Bayramı, Baku once again is in the hands of its residents … Like the salvation of a man in the cage of the infamous guillotine, the liberation of Baku is a marvelous achieved dream.”

The tense struggle of the Great powers over the oil-rich Baku ended with the victory of Azerbaijan. The liberation of its capital was the first most important achievement of the newly established Azerbaijani Democratic Republic. It should be emphasized that whatever the motives behind its involvement, without the assistance of the Ottoman Empire it would be very difficult, if not impossible at all, to achieve this inestimable victory.