The Kenyan high court has given parliament 60 days to implement a rule on gender balance or risk being dissolved.
According to the Kenyan constitution, no more than two-thirds of the members of elected public bodies should be of the same gender.
There are only 69 female MPs out of a total of 349 - this includes 47 seats reserved for women representatives. There should be 117 women if the two-thirds rule is applied.
So far parliament has failed to find alternative ways of bridging the gap, and in May last year it voted to reject the gender rule altogether.
A group of civil society organisations brought the case in an attempt to compel the government to enact the law before the general election in August.
Judge John Mavito said anybody would be able to petition the chief justice to dissolve parliament if the law was not passed.
Kenya currently ranks 100th out of a list of 193 countries in terms of the proportion of female MPs, according to the Inter-Parliamentary Union.
Rwanda is at the top of the list with 61.3% of its MPs being women.