A top Russian court has told encrypted messaging app Telegram to share its encryption keys with state authorities.

Telegram, founded by Russian entrepreneur Pavel Durov, has been fighting an effort by the FSB, the state's security service formerly known as the KGB, which last year demanded that the company hand over its private encryption keys.

The company refused. On Tuesday, the country's supreme court upheld the demand.

Telegram was issued a fine and ordered by the state communications regulator to provide the keys within 15 days. If the company refuses, the service will be blocked in the country.

Bloomberg first reported the news.

Durov said in a tweet following the ruling: "Threats to block Telegram unless it gives up private data of its users won't bear fruit. Telegram will stand for freedom and privacy."

The encrypted messaging app rose to prominence with privacy-minded users -- with more than 100 million users across the world. The app is also popular with terrorists for sharing communications and spreading propaganda and misinformation.

It's also been heavily criticized for having several security issues and running an infrastructure that allows the storing of encryption keys in the first place.

Matthew Green, a cryptography professor at Johns Hopkins, once said in a tweet that the app's encryption is "like being stabbed in the eye with a fork."

Other messaging apps, like WhatsApp and Signal, are end-to-end encrypted and do not centrally store encryption keys.

Russian president Vladimir Putin, who this week secured a fourth term in office, introduced laws to crack down on terrorism. It was widely seen as an effort to stifle free speech under an increasingly authoritarian rule.

The laws forced companies operating in the country to store data on Russian citizens within its borders, giving state security and the intelligence services authority access to the data. It also gave the FSB greater control over the Russian internet, and it could see sites removed from the country's internet register if they refuse to turn over customer or user data.

Many Western companies have complied with the new order. Others, like LinkedIn, refused -- and remain blocked in the country.