Farmajo said the talks with King Salman was fruitful and the two countries made progress on strengthening bilateral ties.
The Somali president, accompanied by government officials, also held meetings with the Saudi crown prince Mohamed Bin Salman in Jeddah and they discussed issues including economic partnership among others.
The visit follows Somalia’s reiteration of its neutral stands last week in the Gulf crisis that saw Saudi Arabia, Egypt and the United Arab Emirates, cut diplomatic relations with Qatar in June.
They accused Qatar of supporting Islamist militants and Iran. Qatar vehemently denies the claims.
Some African countries took sides in the diplomatic row with Chad recalling its ambassador from Qatar “for consultations” after Senegal recalled its envoy citing its “active solidarity” with Saudi Arabia.
Mauritania, a member of the Arab League, severed ties with Qatar following the lead of Saudi Arabia, the United Arab Emirates, Bahrain and Egypt – while Gabon condemned Doha.
However, Guinean President Alpha Conde offered to mediate in the diplomatic crisis in his capacity as chairperson of the African Union to find a swift and peaceful solution.
Somalia’s neutrality was met by opposition from three states including Puntland, Hirshabelle and recently Galmudug who have taken the Saudi-led side and called on the government to change its position due to its good relations with Saudi Arabia and UAE.