A gunman opened fire inside Estonia's Defense Ministry and tried to take hostages on Thursday, but he apparently was shot and killed by police who stormed the building, an official said.

The attacker entered the ministry in downtown Tallinn at midday, threw a smoke bomb, fired shots and tried to kidnap two employees, but police quickly evacuated the building and officers wearing bulletproof gear entered it, officials said.

Defense Minister Mart Laar was not there at the time, ministry spokesman Hannes Kont told The Associated Press.

News footage showed several ministry employees climbing out 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 Defense Ministry I heard several shots and a powerful explosion and also smelled the gunpowder smoke," he told SVT by telephone.

An official at the country's Security Police would not say how the shooter died, but a spokesman for the northern district prosecutor's office, Maria-Elisa Tuulik, said he apparently was shot and killed by the police.

Police would not identify the attacker, but Estonian media, citing unidentified ministry officials, said he was a former soldier.

The attack shocked the tiny, serene Baltic nation of 1.3 million people that joined the NATO alliance in 2004.