BELGRADE (Reuters) - Serbia has introduced a state of emergency to halt the spread of coronavirus, President Aleksandar Vucic said on Sunday after meeting top government and health officials in Belgrade.

Vucic said he was acting in line with legal provisions that allow him to declare a state of emergency in the absence of a sitting parliament, which was disbanded ahead of April 26 general elections.

"From this very moment we have a state of emergency," Vucic said in a televised address, adding that the government will formulate the "harshest measures" soon.

He said that the fight "against an invisible adversary" will be aimed at the protection of the elderly, who are particularly at risk from the outbreak.

Vucic said kindergartens, schools and universities will be closed until the end of the semester.

Health authorities in the Balkan country have so far reported 46 cases of infection and tested 283 people. There have been no fatalities, but two patients are in a serious condition.

Vucic warned that from Monday the military will be guarding hospitals, while police will be monitoring those quarantined or in self-isolation for 14 or 28 days. Those who violate quarantine may face jail terms of up to three years, he said.

"There will be limitations of all sorts," he said.

Serbia has already banned indoor gatherings, and has closed borders to nationals of a number of countries including Italy, Iran, parts of China, South Korea and Switzerland.

After Vucic's address, Prime Minister Ana Brnabic announced restrictions on Serbia's borders, where the military will be deployed.

"Borders will be open for Serbians, foreign diplomats and foreign nationals with residence permits," she told state-run RTS TV.

Many Serbians who live and work in the European Union flocked home over the weekend, although Vucic had requested they avoid travelling to Serbia.

Hundreds of cars created gridlock at the border with Hungary on Sunday where they remained stranded for hours, awaiting entry permits from Serbia's health authorities.

(Reporting by Aleksandar Vasovic; Editing by Alexander Smith, Jan Harvey, William Maclean)