When Somali President Mohamed Abdullahi Farmaajo flew to South Africa last week to attend the inauguration of President Cyril Ramaphosa, he avoided Kenyan airspace.
This comes at a time when the two countries were involved in a diplomatic tiff over immigration rules, was telling to some observers.
Kenya recently barred three Somali officials, part of a delegation coming to attend a cross-border conflict management programme, over failure to obtain visas from the Kenyan embassy in Mogadishu, a move that angered the Somalia administration so much that it asked its officials to boycott the UN-Habitat Assembly held in Nairobi last week.
Then on Tuesday, May 28, Kenya's aviation authorities further banned unaccompanied luggage on aircraft from Somalia and insisted that all planes land at Wajir airport in northern Kenya for security checks.
The deterioration of relations between the two neighbours has been blamed on the dispute over the maritime border in a resource-rich triangle in the Indian Ocean, which is the subject of a case at the International Court of Justice in The Hague, Netherlands.
But behind this dispute, analysts say, are economic and political interests as Western, Asian and Gulf powers scramble for the vast gas and oil deposits in the Indian Ocean triangle coveted by the two countries.
What started as an economic dispute over the maritime boundary has now exposed bilateral and internal rifts that are threatening the region, owing to the volatile nature of Somalia's politics and security situation.
At play are oil companies from the West -- Norway, the US, UK, France, Netherlands and Italy -- and the political divide in the Middle East that pits a group of countries led by Saudi Arabia and United Arab Emirates against those led by Qatar, jostling for an upper hand in Mogadishu.
Prior to 1991, when Somalia disintegrated into small fiefdoms, oil blocks had been licensed to major oil companies and their subsidiaries, including British Petroleum, Royal Dutch Shell, Italy's ENI and Total of France, for offshore evaluation.
Some two-thirds of the oil map was awarded to US firms--Conoco Phillips, Amoco and Chevron.
In 2014, Soma Oil and Gas Exploration Ltd negotiated a deal with Somalia in which it was awarded the right to exploit 12 offshore oil and gas blocks amounting to 60,000 square kilometres.
It is worth noting that current Somali Prime Minister Hassan Khaire, was the executive director for Africa at Soma Oil and Gas before he was appointed PM.
In the current tiff, analysts are unanimous that Kenya and Somalia are too intrinsically connected economically, politically and culturally to afford an escalation.
Dr Abdiwahab Sheikh Abdisamad, an analyst of Somali affairs, blames the tension on foreign actors who have interests in Somalia.
But he warns that should the antagonism continue, it could result in economic losses for Kenya, given that Somalia is a big market for Kenya's manufactured goods, miraa (khat) and aviation services, with all flights flying to Somalia registered in Kenya.
Kenyans comprise the biggest foreign labour force in Somalia and Somalis are major investors in Kenya. Eastleigh, a suburb in the Kenyan capital Nairobi, is dominated by Somali traders.
The downstream oil market is also now attracting a lot of interest from Somali investors as is real estate.
An escalation of hostilities could hurt Kenya's economy amid claims that more than $2 billion enters the country from Somalia, propping up the shilling.
But the biggest concern, though, is that the war against Al Shabaab would suffer to the detriment of both countries, especially if Somalia were to stop co-operating with Nairobi in sharing security intelligence.
Also, Kenya, Uganda and Burundi contribute troops to the peacekeeping African Mission in Somalia, Amisom, and have been under pressure from the African Union (for Uganda and Burundi) and internally (for Kenya) to withdraw all or part of their troops from Somalia. The three states have suffered losses of troops and military hardware from Shabaab attacks.
After its officials were "mistreated" in Nairobi in the visa incident, Somalia directed international non-governmental organisations with operations in Somalia but operating out of Nairobi, to relocate to Mogadishu or cease operations, something likely to impact aid and humanitarian services.
Case at the ICJ
But some analysts are dismayed by Kenya's latest stance against Somalia, saying Nairobi has resorted to arm-twisting Mogadishu after the latter refused to withdraw the case at the ICJ, which comes up for hearing this September.
This was after Ethiopia had brokered an understanding that the two countries would resolve the boundary row through bilateral arrangements.
The ICJ is supposed to decide whether the marine boundary between the two countries runs parallel to the line of latitude to the east or southeast as an extension of the land border.
Kenya has been trying to persuade Somalia to withdraw the case and allow an out-of-court settlement, which could include shared development of the oil and gas resources as it has happened elsewhere on the continent. Efforts to get Ethiopian Prime Minister Abiy Ahmed to mediate have failed.
Farah Maalim, a Kenyan politician who was deputy speaker of parliament, says Nairobi has come out looking bad by appearing to hit back at Mogadishu over the case at the ICJ.
"When you submit yourself to a judicial process by prosecuting or defending a case, you are bound to accept the outcome. Both Kenya and Somalia have submitted themselves to ICJ jurisdiction and must be ready to accept whatever the outcome," he told The EastAfrican.
Both countries are claiming ownership of the 100,000 square kilometres in the Indian Ocean with its oil and gas deposits, over which Somalia took Kenya to ICJ in 2014, pleading encroachment on its marine territory.
In February, Kenya was angered by Somalia's hosting of an oil conference in London for potential prospectors in which it allegedly exhibited seismic data of oil blocks in the ICJ case. Mogadishu said that the four blocks in the disputed triangle were not part of the auction.
But while it takes Somalia, it has not been lost on Kenya that the Farmaajo administration appears determined in its pursuit.
Observers say Somalia is confident that the ICJ case will be decided in its favour, perhaps because the court's president is a Somali.
However, there is nothing to suggest that Judge Abdulqawi Ahmed Yusuf will decide the case over considerations that are not legal. Mr Yusuf to an independent legal mind who studied in France."
But internal politics is seen as influencing President Farmaajo's hardline stance in the dispute and other foreign engagements. He is seeking a second term in office and appearing weak could cost him the seat in the 2021 elections.
After Ramaphosa's inauguration in Pretoria, the Somali leader met with Somalis living in South Africa with a nationalistic message: "Hold your heads high, we are strong. Nobody can violate Somalia's territorial integrity."
He urged Somalis to stand up for their country and ruled out any possibility of giving out the contested areas.
"As long as we live, no one can take away our land. We will die for it," he told the cheering crowd.
Ayub Wafula, a lecturer in political science at Kenya's Kisii University, says Somali politicians will certainly want to act in a way that meets the expectations of the electorate by showing that they will not cede the territory without a fight.
"Somali politicians are telling their people that they are not going to let it go," he said.
So why is President Farmaajo banking on the ICJ, in the face of diplomatic pressure from Kenya?
"Farmaajo is eagerly waiting for the verdict, since he is seeking re-election. For him, it is a political tool: If the court rules in favour of Somalia, Farmaajo will be the undisputed leader of Somalia for the next four years," said Dr Abdiwahab Sheikh Abdi.
"He is incapable of negotiating anything for now. If he signs an agreement with Kenya, he will no longer be head of state. The guy is between a rock and a hard place," he told The EastAfrican.