Slovenia's prime minister said Wednesday he is resigning after the country's top court annulled last year's referendum on a key railway project and ordered a new vote.

Miro Cerar said he sent his resignation to parliament and will formally notify the president Thursday. The move means that Slovenia's parliamentary elections, which were due in early June, will be held a few weeks earlier.

"I have made a decision any trustworthy politician should make in such a situation," Cerar said in a statement broadcast live. "You (citizens) will have a chance in the elections to judge between right and wrong and who deserves your support."

Cerar also praised his center-left government's achievements in curbing an economic downturn in the tiny European Union nation of 2 million people that is the home country of U.S. first lady Melania Trump.

"During my term the economic crisis ended. Slovenia has stable economic growth, third strongest in EU," he said. "We have the lowest unemployment rate after 2009."