A man fired shots and set off a smoke bomb at the Defense Ministry in Estonia's capital Tallinn and then was killed as police moved in, officials said on Thursday.
The motive of the man who carried out the attack, a rare incidence of such violence in the small Baltic state of 1.3 million people, was not clear, the authorities said.
They named the man as Karen Drambjan and said he was born in 1954, without giving a precise birth date.
The prosecutor's office said in a statement Drambjan broke into the Defense Ministry building in the center of Tallinn and threw a smoke bomb.
It had initially said the man took two hostages, but in a later statement it said the people were caught in the building when it was evacuated and were later freed.
"The unknown man who entered the Ministry of Defense building slightly after three in the afternoon today was killed in the course of the joint operation carried out by the police and the Security Police," the statement said. "Nobody else suffered any injuries."
It said the man was armed with a pistol and with packets of explosives. It denied the man committed suicide, as had been said by some officials earlier. The prosecutor's office said the man had no link with the armed forces.
"The motive of his action has remained unclear," Prime Minister Andrus Ansip was quoted by news portal Delfi as saying.
"This is depressing. It looks like someone has been inspired by the events in Norway," he said, referring to the July 22 rampage and bombing that left 77 dead and suspected gunman Anders Breivik in custody.
A report on the website of Russian-language newspaper Dyen za Dnyom said Drambyan's apartment had been sold by court bailiffs on the eve of the attack.
Defense Minister Mart Laar was quoted by Delfi as saying that the man had hundreds of bullets, a bag of explosives and a gas mask. Laar was not in the building when it was attacked.
Estonian media said Drambjan was born in Yerevan, Armenia, held a university degree in law and owned a small law firm. He had joined a small left-wing political party.
Such incidents are extremely rare in Estonia, a former Soviet state which regained its independence in 1991 and joined the European Union and NATO in 2004.
The most recent unrest was in 2007 when Russian-speaking youths rioted and looted the city center for two days after authorities put a statue of a Red Army soldier, that had been in the center, in a cemetery.