Somalia's President Mohamed Abdullahi Mohamed has signed a controversial law extending his mandate for another two years, despite threats of sanctions from the international community.

State broadcaster Radio Mogadishu said the president, better known by his nickname Farmajo, had "signed into law the special resolution guiding the elections of the country after it was unanimously passed by parliament".

Somalia's lower house of parliament on Monday voted to extend the president's mandate -- which expired in February -- after months of deadlock over the holding of elections in the fragile nation.

However the speaker of the Senate slammed the move as unconstitutional, and the resolution was not put before the upper house, which would normally be required, before being signed into law.

Speaker Abdi Hashi Abdullahi said it would "lead the country into political instability, risks of insecurity and other unpredictable situations".

Farmajo and the leaders of Somalia's five semi-autonomous federal states had reached an agreement in September that paved the way for indirect parliamentary and presidential elections in late 2020 and early 2021.

Somalia's lower house of parliament on Monday voted to extend the president's mandate after months of deadlock over the holding of elections
Somalia's lower house of parliament on Monday voted to extend the president's mandate after months of deadlock over the holding of elections AFP / Yasuyoshi CHIBA

But it fell apart as squabbles erupted over how to conduct the vote, and multiple rounds of talks have failed to break the impasse.

The new law paves the way for a one-person, one-vote election in 2023 -- the first such direct poll since 1969 -- which Somalis have been promised for years and no government has managed to deliver.

A presidential election was due to have been held in February. It was to follow a complex indirect system used in the past in which special delegates chosen by Somalia's myriad clan elders pick lawmakers, who in turn choose the president.

The international community has repeatedly called for elections to go ahead.

The United States, which has been Somalia's main ally in recovering from decades of civil war and fighting Al-Qaeda-linked Islamists, said Tuesday it was "deeply disappointed" in the move to extend Farmajo's mandate.

Somalia was to have held a presidential election in February
Somalia was to have held a presidential election in February AFP / -

"Such actions would be deeply divisive, undermine the federalism process and political reforms that have been at the heart of the country's progress and partnership with the international community, and divert attention away from countering Al-Shabaab," US Secretary of State Anthony Blinken said in a statement.

He said the implementation of the bill would compel the US to "re-evaluate our bilateral relations... and to consider all available tools, including sanctions and visa restrictions, to respond to efforts to undermine peace and stability".

The European Union's foreign policy chief Josep Borrell also threatened "concrete measures" if there was not an immediate return to talks on the holding of elections.

A coalition of opposition presidential candidates said in a joint statement that the decision was "a threat to the stability, peace and unity" of the country.

In February some opposition leaders attempted to hold a protest march, which led to an exchange of gunfire in the capital.

Somalia has not had an effective central government since the collapse of Siad Barre's military regime in 1991, which led to decades of civil war and lawlessness fuelled by clan conflicts.

The country also still battles the Al-Qaeda-linked Al-Shabaab Islamist militant group which controlled the capital until 2011 when it was pushed out by African Union troops.

Al-Shabaab retains parts of the countryside and carries out attacks against government, military and civilian targets in Mogadishu and regional towns.

Somalia still operates under an interim constitution and its institutions, such as the army, remain rudimentary, backed up with international support.

The 59-year-old Farmajo -- whose nickname means cheese -- was wildly popular when he came to power in 2017.

The veteran diplomat and former prime minister who lived off and on for years in the United States had vowed to rebuild a country that was once the world's most notorious failed state, and fight corruption.

However observers say he became mired in feuds with federal states in a bid for greater political control, hampering the fight against Al-Shabaab, which retains the ability to conduct deadly strikes both at home and in the region.