Qatar has withdrawn its troops from the Djibouti-Eritrea border, the foreign ministry said on Wednesday, after years of mediating in a territorial dispute between the two African states.

"The state of Qatar informed the government of Djibouti that it has withdrawn all its troops deployed on the border line in Djiboutian territory," a ministry statement said.

The decision by Qatar to withdraw its troops comes as the Gulf kingdom is locked in a bitter dispute with Saudi Arabia and its allies over its alleged ties to "terrorist" groups and close relationship with Iran. Doha denies all claims.

Qatar informed the government of Djibouti that it has withdrawn all its troops

- Foreign ministry statement

Both Djibouti and Eritrea have good relations with Qatar's leading opponents Saudi Arabia and the United Arab Emirates, and have taken their side in the Gulf split.

Djibouti downgraded ties with Qatar last week, saying it was acting in "solidarity with the international coalition combating terrorism and extremist violence, as well as with the Gulf and Arab countries".

Eritrea's Information Ministry said on Monday the decision by Saudi Arabia, the United Arab Emirates, Bahrain and Egypt to sever ties was a move "in the right direction".

Djibouti also cut ties with Iran, Saudi's regional rival, over the January 2016 storming of the Saudi embassy in Tehran by crowds incensed by Riyadh's execution of the Shia cleric Nimr al-Nimr.

The Qatari ministry statement said the kingdom had been an "impartial diplomatic mediator" in the dispute between Djibouti and Eritrea since 2010, which ended two years of border clashes.

The statement said it would "continue to be a major player in the international community".

Fighting over the un-demarcated area in the Red Sea, known as Doumeira, killed 35 people and left dozens of others wounded.

The leaders of Eritrea and Djibouti signed a pact in Doha in 2010, under the auspices of Qatar's then-emir Hamad bin Khalifa al-Thani, to pursue a negotiated settlement.

Reports in 2010 stated that Qatar had sent an estimated 700 soldiers to the border to oversee the agreement. A UN monitoring group says there were 200 stationed on the border at the last count.

Qatar has also played the role of mediator in other African conflicts.

It brokered a peace deal between the Khartoum government and rebels in the Red Sea coast region of Sudan, which borders Eritrea. It has tried to do the same in the conflict in Sudan's western region of Darfur.

But is the second time that Qatari troops have come home since the rift among Gulf states began. A Qatari contingent stationed in Saudi Arabia as part of the Saudi-led coalition fighting the Iran-aligned Houthis in Yemen returned last week.

The forces had been stationed in the south of the kingdom to reinforce Saudi defences against Houthi attacks.

African foothold

Saudi Arabia was in January reported to be finalising a deal to build a military base in Djibouti, according to Djibouti’s foreign minister, Mahmoud Ali Youssouf.

"We’re going to sign a military co-operation agreement soon in Riyadh," Youssouf said in an interview with the Financial Times.

"I cannot give you the details because this is military stuff and is classified. But you will see when it will happen."

The African state, which lies on the strategic Horn of Africa, already hosts a US base for 4,000 soldiers and French military facilities.