Somalia has kicked out the country's top United Nations official in a decision likely to harm relations with foreign powers backing government attempts to restore stability after decades of turmoil.
The government accused Nicholas Haysom, Special Representative of the UN Secretary-General, of interfering with internal affairs.
Haysom raised questions in a December 30 letter about the involvement of UN-supported Somali security forces in the arrest of a former militant of the Islamist al Shabaab group who was blocked from running in a recent regional election.
Haysom "is not required and cannot work in this country", the foreign affairs ministry said. "He openly breached the appropriate conduct of the UN office in Somalia," said the statement late on Tuesday, which effectively makes the South African persona non grata.
There was no immediate comment from the UN mission which also supports an African Union peacekeeping force fighting al Shabaab.
Haysom's letter to the interior security minister expressed concern over the government's handling of the arrest of former Shabaab leader Mukhtar Robow and subsequent unrest last month.
At least 15 civilians were killed and around 300 people detained, most of them children, when protests erupted after Robow's arrest in the southern city of Baidoa, according to the U.N. letter.
The government said Robow was arrested on suspicion that he had brought militants and weapons back to Baidoa, the capital of South West region where he tried to contest for president in last month's election.
His arrest sparked clashes between militiamen loyal to Robow and Somali forces. Ethiopian security forces, who are part of an African Union peacekeeping force, were also involved.
Al Shabaab has sought for over a decade to topple the central government and implement its strict version of Islamic law. It was driven out of the capital in 2011 but maintains a foothold in some regions including South West.
Robow renounced violence and recognised federal authority in 2017.
In the letter, Haysom asked the minister to explain the legal basis for Robow's arrest. He also asked what action had been taken to investigate the deaths during the demonstrations in Baidoa following the arrest.
The UN letter also contained an annexed letter from the European Union, Germany and Britain announcing the suspension of their support to the police in South West state due to their conduct during last month's election.
Haysom also detailed the UN support to the Somali police force and the South West regional police which includes the payment of stipends to the police.
The United Nations is a major backer of Somalia, a country that has lacked a strong central government since 1991. The government's decision over Haysom could intensify a confrontation between Mogadishu and the semi-autonomous regions.