PODGORICA, May 9 (Reuters) - Two Russian intelligence officers and two opposition politicians were among 13 people sentenced on Thursday over a 2016 election day plot aimed at toppling Montenegro's government, killing the prime minister and bringing a pro-Russian alliance to power.

The verdict given in the heavily guarded Montenegro court said that on Oct. 16, 2016, the accused planned to attack state institutions and kill then-Prime Minister Milo Djukanovic, who has led the Adriatic country almost continuously, either as prime minister or president, for three decades.

The two Russian nationals, identified in court as Eduard Shishmakov and Vladimir Popov and described as Russia's military intelligence officers, were sentenced in absentia to jail terms of 15 and 12 years respectively.

Moscow has repeatedly dismissed accusations about their role as absurd. All the accused denied wrongdoing. Under Montenegrin law, they have the right to appeal to the higher court.

The verdict said that one of the aims of the coup attempt was to prevent Montenegro, which became independent in 2006 after it split from Serbia, from joining NATO, which it did in June 2017. Montenegro also wants to join the European Union.

"Every member of the criminal organization had a predetermined task and role," Judge Suzana Mugosa said at the end of the 19 month trial. "All included in the indictment are guilty for attempting an act of terrorism."

"In the functioning of (this) criminal group there was the readiness for the use of violence and intimidation," she said.

Montenegro's opposition, which supports weekly anti-government protests in Podgorica, accused the authorities of fabricating the plot to secure the narrow election victory for Djukanovic and his Democratic Party of Socialists in 2016.

Andrija Mandic and Milan Knezevic, leaders of the Democratic Front, an opposition alliance that wants to depose Djukanovic, who has been the president since 2018, and seeks closer ties with Serbia and Russia, received five-year jail terms each.

They were also absent from the court.

Earlier in the day Knezevic told local Vijesti TV that he and Mandic would await sentencing with their "most trustworthy men" somewhere in Podgorica.

Bratislav Dikic, a retired Serbian police general, was sentenced to eight years in jail.

Although the court building and the surrounding area was heavily guarded by police armed with submachine guns, there were no incidents. (Writing by Aleksandar Vasovic; Editing by Alison Williams)