Outgoing President Voronin had backed Prime Minister Greceanii's candidacy
Moldova's constitutional court has ruled that outgoing President Vladimir Voronin must dissolve parliament and call early legislative elections.
Mr Voronin had asked the court to decide whether it was necessary after MPs twice failed to elect a president.
His Communist Party was unable to muster enough votes for its candidate, Prime Minister Zinaida Greceanii.
Opposition parties boycotted the vote in a continuing protest over April's election, which they say was rigged.
The dispute led to violent demonstrations, including the storming of parliament, and increased tension between Moldova and neighbouring Romania. At least two people were killed in the unrest.
International observers said the election was generally fair.
Last week, the governing Communist Party for a second time failed to garner the 61 votes required to elect a new president outright after the 40 opposition MPs in the 101-seat assembly boycotted the vote.
The Communist Party is one short of the three-fifths majority its requires
Under Moldova's constitution, the second failure meant parliament had to be dissolved and new elections called, although there was flexibility in the timing.
Mr Voronin, in his capacity as outgoing president and the newly elected parliamentary Speaker, consulted the constitutional court on how to proceed.
"The president in office not only has the right, but also the obligation, to dissolve parliament and name a date for an early election," Judge Elena Safaleru said on Friday.
On Wednesday, parliament endorsed an interim government headed by Ms Greceanii to run the country pending the new elections.
Mr Voronin has served the maximum two terms as president.
His successor will lead the poorest country in Europe - where the average wage is just under $250 (£151) a month - and will inherit an unresolved conflict over the breakaway region of Trans-Dniester.