MOSCOW — An explosive device detonated inside an office of Russia’s main security agency on Wednesday, wounding three workers and killing the person who carried it, the Russian authorities said.

The explosion at the local headquarters of the Federal Security Service in the northern city of Arkhangelsk was labeled a terrorist act by the Russian Investigative Committee, which is responsible for high-profile crimes and is investigating. It said in a statement that the attacker was a 17-year-old local resident, but did not offer any other information.

“According to preliminary information, the person entered the building, took an unknown item out of a bag, which exploded shortly after in his hands,” the Russian Antiterrorism Committee said in a statement.

“He suffered injuries that killed him,” it said. “Three employees of the Federal Security Service were injured.”