A 17-year-old has died of his wounds after detonating explosives in an office of Russia's FSB federal security service in the north-western city of Arkhangelsk, officials say.
Three FSB employees were hurt when the explosives went off just inside the building at around 09:00 (06:00 GMT).
The blast caused serious damage.
A CCTV image of the suspect emerged soon afterwards, along with a message he allegedly posted on social media just before the blast.
Although the authenticity of the message posted on an anarchist chat group has not been confirmed, the user identifies himself as an anarcho-communist and claims the FSB "fabricates cases and tortures people".
College student who 'did not drink'
Russia's anti-terrorism committee said, according to initial findings, the suspect was a 17-year-old local resident who had gone into the building and pulled out of his bag an "unidentified object that exploded in his hands".
He was later named by local media as Mikhail Zhlobitsky, a student at a local technical college. His grandmother told BBC Russian that she could not understand why he had blown himself up.
"He doesn't drink or smoke, and he doesn't swear. He doesn't play truant - he always attends college. I've no idea what happened," she said.
Who was teenage bomber?
By Sarah Rainsford, BBC News, Moscow
Just before the explosion in Archangelsk, a user on the Telegram messaging app named "Valeryan Panov" warned that he was about to bomb the local FSB building. As his device could only be detonated by pressing a button on the top, he said he would "probably die" in the blast.
It's not yet clear who wrote that post in an anarchist chat group. His messages have now been deleted.
But screen shots from Telegram show that in September the same user had posted detailed instructions on how to manufacture explosives. A couple of weeks later he discussed the mass shooting by an 18-year old student at a vocational college in Crimea.
"Valeryan Panov" commented then that you could make a "decent explosive device" on a student grant. He was back online on Tuesday, discussing explosives.
After the blast in Archangelsk, the bomber was named locally as Mikhail Zhlobitsky. Pictures of his student ID were posted online and appear to match the images of the young man captured on CCTV inside the FSB building, just before the attack.
According to two of his online friends contacted by BBC Russian, Mikhail Zhlobitsky operated a social media account using the name of a 19th Century Russian revolutionary, Sergei Nechayev. That account was last accessed at 07:32 on the morning of the attack.
The blast was described as a terrorist attack. Governor Igor Orlov said local authorities in Arkhangelsk, around 1,200km (750 miles) north of Moscow, had taken measures to heighten security in all public buildings.
Earlier this month, another teenaged student, Vladislav Roslyakov, murdered 19 students and teachers before shooting himself at a polytechnic college in Russian-annexed Crimea.
Attacks on security services are unusual in Russia, although police have been targeted in parts of the Caucasus, including Chechnya and Dagestan.
The FSB has been behind two controversial cases this year, against groups accused of plotting violent uprisings, the BBC's Sarah Rainsford reports from Moscow.
In both, human rights groups argued the claims were false, while they said statements in one case were extracted under torture.