Turkish and Qatari navies have carried out a joint exercise in the Gulf Arab country, in a sign of growing military ties between the two nations.

Hundreds of troops from both sides participated in the exercise, dubbed Iron Shield, on Monday.

The Qatari military said the exercise was aimed at exchanging information, training senior military officials, and improving coordination between the two forces to boost security.

In addition to the naval drill, Qatari and Turkish infantry and artillery forces took part in a ground training exercise.

Turkey's parliament on June 5 fast-tracked the approval of a bill that allows troops to be deployed to a Turkish military base in Qatar. It also endorsed an agreement that allows the Turkish military to train Qatari security forces.

READ MORE: Moves against Qatar 'violate human rights'

The Turkish move came days after Saudi Arabia, the United Arab Emirates (UAE), Bahrain and Egypt severed relations with Qatar, accusing it with financing and supporting "terrorism" - allegations Doha denies.

The blockading countries closed their airspace to commercial flights from Qatar as Saudi Arabia shut down the country’s only land border.

Turkey and Qatar are close allies on foreign policy issues, such as Palestine, Syria and Egypt.

The first Turkish troop deployment to Qatar was in 2015.

'Base prevents mistakes'

Yasin Aktay, a senior member of the ruling Justice and Development Party (AK Party), told Al Jazeera that Turkey's military presence in Qatar “creates a balance in the region” that prevents potential clashes.

"Turkey is protecting its own interests through the base in Qatar, rather than taking sides between the parties at odds. And Ankara's interests require stability in the region. Therefore Turkey would be against an attack on Saudi Arabia as much as Qatar," Aktay told Al Jazeera.

"There would always be forces to fill the vacuum when there are unbalanced situations like [developments in the Gulf region]. And Turkey's interests require it not to leave a power vacuum there. Turkey's existence there prevents potential mistakes."

Turkey and Saudi Arabia are both in the US-led coalition against the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) group. Saudi Arabian fighter jets join anti-ISIL operations through Turkey's Incirlik airbase.

Riyadh and its allies have called for the closure of Turkey's military base in Qatar as part of their demands to resolve the GCC crisis.

RELATED: New batch of Turkish troops arrives in Qatar

Turkish President Recep Tayyip Erdogan had said that the demands were "against international law" and rejected closing down the base.

Ankara had offered to form a military base in Saudi Arabia but was denied by government sources, according to Saudi state media.

Battalions of infantry and artillery from both sides also took part in a two-day ground forces component of the training exercise.

Follow Umut Uras on Twitter: @Um_Uras