The FSB said in a statement that one of its officers was killed in armed clashes while arresting "terrorists" on the night of August 6-7 while a Russian soldier died in a firefight with "sabotage-terrorist" groups sent by the Ukrainian defence ministry on August 8.
The allegations will fuel further tensions in the feud between Russia and Ukraine, sparked when Moscow annexed Crimea from Kiev in March 2014 after Kremlin-backed president Viktor Yanukovych was ousted.
Ukraine's defence ministry dismissed the allegations as "nothing more than an attempt to justify the redeployment and aggressive actions" of Russian forces in the region.
The Organisation for Security and Cooperation in Europe (OSCE) monitoring the frontier between mainland Ukraine and Crimea did not report any incidents.
More From This Section
But it said road traffic was halted this earlier this week and border guards appeared to be on "heightened alert".
In its statement, the FSB -- which controls Russia's border guards -- said it had "foiled terrorist attacks on the territory of Crimea prepared by the intelligence directorate of the Ukrainian defence ministry".
The security agency said that in the August 6-7 raids, several people were detained, including a Ukrainian military intelligence officer, and a cache of explosives was discovered.
"On the night of August 8 2016 special operations forces from the Ukrainian defence ministry carried out two more attempts to make a breakthrough by sabotage-terrorist groups," it said.
The assault included "massive firing from the side of the neighbouring state and armoured vehicles" but was beaten back by the Russian authorities, the statement said.