One of the manifestations of the Qatar-Turkey cooperation is the presence of Turkish troops on Qatari soil, in accordance with the defense agreement "on cooperation in military training, defense industry and deployment of the Turkish armed forces in the territory of Qatar," signed by the leaders of the two countries on December 19, 2014 at the presidential palace in Ankara. As stated, the agreement was signed amid intense tension between Qatar and its neighbors in the Gulf – Saudi Arabia, the UAE and Bahrain – which have a fundamental political and ideological conflict with Qatar, especially over its support for the Muslim Brotherhood and Iran. While many articles in the agreement are couched in mutual terms (i.e., refer to the deployment of Turkish troops in Qatar and vice versa), the title of the agreement, and many other articles within it (e.g., Article 3.1 and 4.1) speak only of Turkish troops deployed in Qatar.
Aimed at "establish[ing] a mechanism to strengthen cooperation in the fields of military training, defense industry, joint military exercises and the deployment of the forces between [Qatar and Turkey]," the agreement states that Qatar will place its airspace and its ports and facilities at the disposal of the Turkish forces. This is specified in Article 4, which lists the following domains of cooperation:
"4.1. Deployment of Turkish Forces in the State of Qatar for the purposes of training and joint
4.2. The Receiving Party [Qatar] permits the Sending State [Turkey] to use for the implementation of this
Agreement its ports/airports/airspace; deploy forces on its territory; benefit from its facilities,
camps, units, institutions and military facilities.
4.3. Ensuring cooperation and bilateral visits between military units and institutions of both
4.4. Holding visits to the ports, airports and military institutions and facilities.
4.5. Exchanging delegations between the Parties.
4.6. Inviting observers to participate in joint manoeuvers and exercises.
4. 7. Ensuring participation in military maneuvers and exercises between the Parties.
4.8. Exchanging information on improving and developing bilateral maneuvers and military
4.9. Exchanging information for the purpose of military maneuvers and exercises.
4.10. Providing training in the fields of military maneuvers and exercises.
SUPPORT OUR WORK
4.11. Cooperating in the field of military logistics.
4.12. Providing humanitarian assistance.
4.13. Exchanging personnel and military equipment between the Parties.
4.14. Assigning advisory personnel in military institutions and exchanging personnel.
4.15. Cooperating in the field of defense industry.
4.16. Cooperating in the fight against terrorism."
Many articles of this agreement rely on the Qatar-Turkey agreement "on training, technical and scientific cooperation," signed by the two countries on May 23, 2007, which calls for cooperation in the following areas:
"1. Military education and teaching.
2. Cooperation between the Land Forces.
3. Cooperation between the Naval Forces
4. Cooperation between the Air Forces.
5. Exchange of military training observers.
6. Cooperation in the defense industry.
7. Military history, military archives, military publications, and museums.
8. The cooperation can include other fields on which an agreement is reached between the parties."
The agreement is for ten years, with successive one-year extensions to take place automatically unless one of the parties wishes to withdraw.
On the strength of the 2014 agreement, which was ratified by the Turkish parliament in March 2015, the first Turkish troops – some 130 soldiers from the Tariq bin Ziyyad battalion, equipped with armored vehicles – arrived in Qatar on October 4, 2015 and were stationed at the Al-Rayyan military base, south of Doha. Al-Rayyan thus became "the first Turkish military facility in the Middle East," as then Turkish Defense Minister Ismet Yılmaz described it. In a December 2015 interview with Reuters, then Turkish ambassador to Qatar Ahmet Demirok said that the base was meant to "help the two countries confront [their] common enemies."
The Turkish military presence in Qatar was perceived as a threat to Qatar's neighbors, as evident from the fact that one of the conditions presented by Saudi Arabia, the UAE, Bahrain and Egypt for lifting the sanctions on Qatar was that it close the Turkish base on its soil and end its cooperation with Turkey.
In April 2016 the two countries' defense ministers signed another military agreement, on the "long-term as well as temporary presence" of Turkish forces on Qatari soil, which spoke inter alia of building a military base for these forces in Qatar. The agreement, which was published on a website operated by Turkish oppositionists in Sweden, is for a period of ten years, with automatic extensions for successive periods of five years unless one or both parties wish to terminate it. Article 1 of the agreement defines its "purpose and scope" as follows: "This Agreement shall determine the principal provisions and requirements that regulate the long term, as well as temporary, presence and activities of Turkish Armed Forces, the status of Turkish Armed Forces in Qatar and Host Nation Support (HNS) of Qatar for the deployment into territory of Qatar." Article 2 states that the Turkish forces to be deployed in Qatar will consist of a joint headquarters, a Coordinator Committee, support components, and land, naval and air components, and that their volume will be determined jointly by the two countries. According to Article 4,"the main mission of the [Turkish] unit [deployed in Qatar] is to support enhancement of defense capabilities of Qatar through joint/combined exercises and training, and subject to approval by both parties, execute training/exercises with other nations' armed forces and contribute to counter-terrorism and international peace support operations and any other missions mutually agreed upon by written consent of both parties [...]. The Parties shall cooperate in improving Qatar defense capabilities through, among others as may be mutually agreed, training, equipping, supporting, supplying, and reforming logistic systems for Qatar Forces. To achieve those, the assigned personnel from the Coordination Committee assist the Qatar General Staff in the following military issues: a. HQ working procedures: personnel, operations, logistics, health, electronic warfare, management of Information systems and equipment, military foreign relations planning, budgeting, b. Courses, training, exercises, military organization and social, sports and cultural activities, c. War weapons and ordnance, defense industry, modernization and technical management issues."
As stated, this agreement was approved by the Turkish parliament on June 7, 2017, in response to an urgent request by the Turkish government, following the escalation of Qatar's conflict with its Gulf neighbors and Egypt, which had imposed an economic boycott on Qatar two days earlier. Turkish President Erdogan approved the agreement on June 9, 2017. Subsequently he visited the headquarters of the Tariq bin Ziyyad battalion in the Turkish base in Qatar, along with a high-ranking Turkish military delegation. During the visit the Turkish forces were given clear directives to assist Qatar in any crisis. At the periphery of the visit several additional cooperation agreements between Turkey and Qatar were signed, in the presence of the Turkish president and the Qatari emir. It should be mentioned that this was Erdogan's second visit to Qatar since the outbreak of the Gulf crisis in June 2017 (his previous visit had been in July 2017).
One of the agreements signed on November 15, 2017 was an agreement on "mutual legal assistance in criminal matters" that effectively exempts Turkish troops deployed in Qatar from any criminal responsibility for certain kinds of offenses, among them military crimes, as well as political and thought crimes. This agreement is phrased in mutual terms, but since there are no Qatari troops in Turkey it currently applies only to Turkish troops stationed in Qatar.
Covering matters of criminal responsibility, extradition and the transfer of legal proceedings and sentenced persons, among other issues, the agreement states that Turkey and Qatar "shall undertake to grant each other... the widest measure of legal assistance in criminal matters" (Article 1). However, Article 11 lists a number of circumstances in which Turkey may refuse a request for such assistance, namely, if it deems the request "to prejudice its sovereignty, its security or its public order," if the request "is contradictory to its Constitution or domestic law," if "the offense subject to the request is a pure military offence, thought crime, political offence or an offence connected with a political offence," and if Turkey has reason to believe that "the person subject to the request would be exposed to an investigation or prosecution or be punished or be exposed to torture or ill-treatment because of his/her race, ethnic origin, religion, nationality, his/her connection to a certain social group or political opinions." The agreement indicates further that, if a member of the Turkish forces returns to Turkey after committing an offence in Qatar, he will not be extradited to Qatar (Article 14).
The agreement was signed for a period of one year, with automatic one-year extensions unless one of the parties wishes to terminate it.
Turkey-Qatar cooperation agreements signed in the presence of the Turkish president and Qatari emir (Source: alkhaleejonline.net, November 15, 2017)
Turkey periodically dispatches new troops to Qatar; to date there seem to be several hundred troops stationed there, most of them in the capacity of advisors to the Qatari armed forces. According to reports, joint exercises are held at the Al-Rayyan base, which, according to Turkish sources, can house 3,000-5,000 troops, if necessary. In December 2017 the base was renamed "the Qatar-Turkey Combined Joint Force Command."
Erdogan visits the Turkish military base in Qatar in late 2017 (Source: dailysabah.com, November 15, 2017)
Turkish troops arrive in Qatar (Source: arabic.sputniknews.com, July 20, 2017)
Turkish tank arrives in Qatar (Source: dailysabah.com, July 19, 2017)
Turkish troops arrive in Qatar (Source: dailysabah.com, December 27, 2017)
As mentioned, the construction of a second Turkish base in Qatar will soon be completed. According to the Turkish Hurriyet daily, the number of Turkish troops in Qatar is to increase significantly, although the daily refrained from disclosing the exact number, due to security considerations. The daily stated further that the new base will be inaugurated in a "grand opening ceremony" attended by the Turkish president and Qatari emir. Classified Turkish military documents reveal that the Turkish government planned to have 2,800 personnel, including 1,434 from the land force, 272 from the air force, and 228 from the navy, in Qatar by December 2019. 
Furthermore, on March 13, 2018, Qatar's Joint Special Forces contracted the Turkish MDS company to construct the "Burouj" naval base in northern Qatar, whose function, according to the Joint Special Forces' commander, Hamad bin 'Abdallah Al-Futais Al-Marri, will be to defend that region. The base is to house a permanent naval force as well temporary ones, and a training center. It is unclear whether Turkish troops are to be stationed there as well.
Turkish and Qatari troops at the Qatari base (Source: hurriyetdailynews.com, August 14, 2019)