Footage showed police cordoning off the area as they helped ministry employees to safety [AFP]

A gunman who took hostages at the Estonian defence ministry has died in a shootout with police, while his two captives escaped unharmed, the regional prosecutor's office said.

"It is confirmed that the suspect has perished," in the police operation, Maria-Elisa Tuulik, of the prosecutor's office, said in a statement on Thursday.

Officials said armed police entered the building in Tallin, the capital, and the gunman was killed in a firefight.

One policeman was injured.

Earlier, police spokesman Mihkel Loide had told the local Delfi news agency that the gunman had killed himself.

Estonian Prime Minister Andrus Ansip identified the dead gunman as Karen Drambjan, a lawyer born in Armenia in 1954, who obtained Estonian citizenship in 1990.

He was a member of the marginal left-wing United Left Party, Ansip told Delfi. The party is not in parliament.

Earlier reports have suggested he was an ex-soldier, but this has been disputed by officials.

Defense Minister Mart Laar was not there at the time, ministry spokesman Hannes Kont told the AP news agency.

Earlier, news footage showed several ministry employees climbing out of a first floor window and jumping to safety while police cordoned off the area.

Hasse Svens, a journalist working for Swedish broadcaster SVT, was near the building when the shooting started.

"When I reached the defence ministry I heard several shots and a powerful explosion and also smelled the gunpowder smoke," he told SVT by telephone.

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.

Source: Agencies