A man fired shots and set off a smoke bomb at the Defence Ministry in Estonia's capital Tallinn and then was killed as police moved in, officials said on Thursday.

The prosecutor's office said in a statement that a man with a gun broke into the Defence Ministry building in the centre of Tallinn. He threw a smoke bomb inside the building and took two hostages, who were later freed.

"The unknown man who entered the Ministry of Defence 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 prosecutor's office said in a statement. "Nobody else suffered any injuries."

A spokeswoman for the prosecutor's office said that the suspect, who was born in 1954, shot himself.

A Defence Ministry spokesman said the man was shot dead during the police operation.

Security Police commissioner Martin Arpo, quoted by newspaper Postimees, said he could not say if the man had served in the army.

"There is no information confirming that, this man did not wear a military uniform," he told the newspaper.

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 centre for two days after authorities put a statue of a Red Army soldier, that had been in the centre, in a cemetery.