With Bulgaria's declaration of independence, relations with the Ottoman State grew tense. However, thanks to Russia's mediation and its doing what was necessary through diplomatic channels, matters were not allowed to come to war. On 6.4.1908 a special protocol was signed in Istanbul in the presence of the Russian, British and French representatives, according to which the Ottoman State declared that it accepted Bulgaria's new political status and its independence (Article 8 of the protocol).

By decision No. 11 of 21.5.1909, Bulgarian diplomatic representatives, delegations and diplomatic agents began to bear the title of embassy. Mikail K. Safarov, sent to Istanbul as ambassador, presented his letter of credence (17.7.1909). Meanwhile, Mustafa Asım Bey presented his own letter of credence in Sofia (14.9.1909). Shortly before the Balkan War, Bulgaria, together with all its allies, delivered a note to the Sublime Porte demanding that the Ottoman State grant administrative autonomy to the Balkan territories inhabited by the Christian population (30.12.1912). The Ottoman Government rejected this note and declared the mobilization of its armies in Europe and Asia. It subsequently recalled all its representatives in the Balkan countries. On 8 October 1912 Montenegro, and on 17 October 1912 Bulgaria and Serbia, declared war on the Ottoman State. Russia took upon itself the protection of Bulgaria's interests in the Ottoman State. Milan K. Popov, sent to the Russian Embassy in Istanbul in the capacity of dragoman (interpreter), remained in this post until the day the Bulgarian legation was reopened. Meanwhile, Spain's delegation in Sofia assumed the task of protecting Turkish interests in Bulgaria.

The war came to an end with the peace treaty signed in London between the Ottoman State and the allies (30.5.1913). Article 1 of this treaty provided for friendship and everlasting peace between the Ottomans and the countries of the Balkan League. Yet the peace did not last even two months. It led to war between the Balkan League and the Ottoman State. After this war, relations between Bulgaria and the Ottoman State were re-established under Article 3 of the Treaty of Istanbul signed on 29.6.1913. After the peace treaty was signed, the Bulgarian government, through the Russian ambassador in Istanbul, Giers, requested that the "agrément" (letter of consent) required for the appointment of a Bulgarian envoy to Istanbul be granted. However, the Ottoman government rejected this request, stating that a number of problems arising from the peace treaty between the Ottomans and Bulgaria had first to be resolved. Within the provisions of the signed peace treaty, Ambassador Andrey Tonasev, sent to Istanbul, presented his letter of credence (2.11.1913). On 2 December 1913 — the Sofia Embassy building, which had been the private house of a tobacco merchant, had been sold to the Ottoman government in 1913. At the time the building passed to the Ottomans, the Ambassador in Sofia was Ali Fethi Bey.

In this period Mustafa Kemal was appointed to the Sofia embassy as military attaché, with the rank of staff major (28 October 1913). His duties as military attaché also covered Belgrade and Cetinje. Mustafa Kemal, who was promoted to the rank of staff lieutenant colonel in Sofia, attended King Ferdinand's masked ball dressed as a Janissary during his time as military attaché in Sofia. The King, thanking him for this interest shown in his ball, presented him with his silver cigarette case. During his posting in Sofia, attempts were made twice to kill Mustafa Kemal because of disputes that broke out among the komitadjis. Mustafa Kemal escaped these plots thanks to warnings given to him by the Macedonian komitadjis. The most important result that the Turkish Ministry of National Defence expected from this appointment was the resolution of military problems between the Bulgarians and the Ottoman State. Mustafa Kemal, who devoted himself to his duty with great meticulousness and competence from the very first day, succeeded in sending the necessary information to Istanbul and in fulfilling the government's requests. In 1914 he rendered important services in the efforts to conclude an agreement with the Bulgarians against the Greeks. This fact can also be understood from the following passages of a letter dated 15 March 1922 sent to Mustafa Kemal by General Kliment Boyadzhiev, who was then the Bulgarian Minister of National Defence:

"I hope you remember the friendship that arose between us at that moment, so very important politically and militarily, when you came to Sofia in 1914 to conclude a military agreement between Turkey and Bulgaria against the Greeks. At that time I was Minister of War. In order to settle the disagreement that had arisen between you and the Chief of the Bulgarian General Staff, I had the opportunity to take part in your talks many times. I remember that on various proposals I sided with Your Excellency. For thanks to your knowledge of military technique and your consummate genius, Your Excellency better appreciated the principles required for the joint operations of our troops. When, having successfully completed the tasks entrusted to you, you departed for Istanbul, in a letter I sent to Your Excellency I conveyed my very best wishes for you and expressed the hope that you would hold a brilliant place in the future destiny of your Fatherland."

It is evident that Mustafa Kemal made the greatest impression on the Bulgarian Minister of War. Surely, in the other circles with which he established relations as well, he succeeded, with his knowledge, tact and outstanding ability, in representing the Turkish Nation and the Turkish army in the best possible way.