In addition, the court ruled that the transfer of 6,000 county government employees to the newly established Nairobi Metropolitan Services (NMS) was illegal.
Judge Hellen Wasilwa of the Employment and Labor Relations Court noted that the Deed of Transfer was not approved by the County Assembly.
The national government was given 90 days to identify various illegalities identified in the ruling.
The ruling is expected to complicate matters for the NMS led by Major General Mohammed Badi, which has already seen various functions transferred to it including construction of roads.
Sonko signed the deed at State House, Nairobi on February 25 in the presence of President Uhuru Kenyatta and Devolution Cabinet Secretary Eugene Wamalwa, but later claimed he did not have an opportunity to read it.
The rift between Sonko and NMS became apparent in April when the Public Service Commission (PSC) announced the secondment of 6,000 county staff to the newly formed agency.
Despite protests from Sonko, the workers affected by transferred functions were summoned to Uhuru Park where they were handed redeployment letters.
It is this redeployment, which was also opposed by workers’ union officials, that Wasilwa declared illegal noting a failure to adhere to various procedures.
The fight between Sonko and NMS later degenerated into a squabble over funds, with Sonko initially refusing to assent to a bill allocating Ksh15 billion to NMS to undertake the transferred functions.
He accused unnamed government officials of overstepping their mandate and hijacking the Deed of Transfer.
Badi lamented that the lack of funds presented a serious challenge to the NMS as they sought to transform the face of the city and improve living standards for residents.
In May, however, the Treasury allocated Ksh26.4 billion to NMS as part of a Ksh53.7 billion post-Covid-19 stimulus package for the 2020/2021 financial year.
“The Head of Public Services submitted the Budget Estimates for Nairobi Metropolitan Services after our submission to Parliament. In this regard, we request for inclusion of NMS budget estimates in the National Government Budget under the presidency,” Treasury Cabinet Secretary Ukur Yattani noted in a letter to the National Assembly.