The Constitutional Court said on Monday that parliament did not act in line with the Constitution when it failed to endorse the creation of the municipalities of Ankaran and Mirna in April.
It ordered the National Assembly to remedy the situation by endorsing legislation establishing both municipalities within two months.
The court highlighted that the creation of a municipality is a part of the Constitutional right to local self-government, ruling that both municipalities met the legal conditions for becoming municipalities.
It said that while the National Assembly has the right to set the conditions under which municipalities can be established, it must respect these rules in deciding on requests of would-be municipalities.
By failing to respect the rules it set, the National Assembly violated the Constitution and acted arbitrarily, said Justice Miroslav Mozetic, who was the rapporteur for the case.
Mozetic said said that in ruling on whether to establish the two new municipalities, parliament should have respected the will of the voters.
The people of both would-be municipalities endorsed the split from the existing municipalities of Koper and Trebnje respectively in referenda in late 2009.
The National Assembly initially endorsed legislation creating the two municipalities, but this was subsequently vetoed by the National Council, the upper chamber, after intense lobbying from the Koper municipality.
Koper has warned that the breaking away of Ankaran would have negative consequences for the port of Koper, part of which lies in Ankaran.
The initiative which initiated the referendum to make Ankaran a municipality opposes the planned expansion of the port.
In a revote on the legislation, the National Assembly fell a vote short of the absolute majority needed to create the new municipalities.
The only reason for not respecting the will of the people in the two would-be municipalities is if Ankaran and Mirna had failed to meet the legal requirements for establishing municipalities, the Constitutional Court added.
The Constitutional Court reached its verdict with seven of the nine justices voting in favour.
As part of its examination of the case, the Constitutional Court suspended local elections in Koper and Trebnje scheduled for 10 October.
In today's verdict it therefore ordered the speaker of parliament to call local elections in all four municipalities within 20 days after the two new municipalities are established.