SILVER SPRING, Md. - Police shot and killed a man upset with the U.S. Discovery Channel network's programming who took two employees and a security officer hostage at the company's headquarters Wednesday, officials said. All three hostages escaped safely.

Police spent several hours negotiating with the gunman, who was upset about the network's programming, after he burst into the suburban Washington building about 1 p.m. (1700 GMT) waving a handgun and with canisters strapped to his body.

Montgomery County Police Chief Thomas Manger said one explosive device detonated on the gunman's body when they shot him, and they were working to determine whether two boxes and two backpacks he also had with him were explosives. The 1,900 people who work in the building were able to get out safely.

Manger said officers were monitoring Lee on building security cameras and tactical officers moved in when they saw him pull out the handgun and point it at one of the hostages.

A law enforcement official speaking on condition of anonymity because the investigation was ongoing said authorities had identified James J. Lee as the likely suspect.

A different official, who spoke on condition of anonymity for the same reason, said Lee previously protested outside the building, where he was arrested and charged with disorderly conduct in February 2008, according to court records.

Police reports indicate he paid homeless people to join his protest and carry signs outside the building. He gave one individual $1,000 for what he considered a prize winning essay.

At one point, a crowd of more than 100 people gathered around Lee, 43, who referred to money as "just trash" and began throwing fistfuls of it into the air.

At the trial, The Gazette of Montgomery County reported, he said he began working to save the planet after being laid off from his job in San Diego. He said he was inspired by "Ishmael," a novel by environmentalist Daniel Quinn and by former Vice-President Al Gore's documentary "An Inconvenient Truth."

A lengthy posting which could be seen Wednesday on a website registered to Lee expressed anger against the Discovery Channel and said it promoted overpopulation.

He said it and its affiliates should stop "encouraging the birth of any more parasitic human infants." Instead, he said, the network should air "programs encouraging human sterilization and infertility."

"NO MORE BABIES! Population growth is a real crisis," he wrote.

He also railed against "programs promoting War" and said solutions should be found for global warming and automotive and factory pollution.

"I want Discovery Communications to broadcast on their channels to the world their new program lineup and I want proof they are doing so," he wrote. "I want the new shows started by asking the public for inventive solution ideas to save the planet and the remaining wildlife on it."

Discovery Communications Inc. operates cable and satellite networks in the U.S., including The Discovery Channel, TLC and Animal Planet. Discovery shows include "Cash Cab" and "Man vs. Wild," and TLC airs "American Chopper" and "Kate Plus Eight."

Animal Planet also airs the controversial series "Whale Wars," about attempts by environmentalists to disrupt the Japanese whaling industry.

After Lee's arrest, a magistrate ordered a doctor's evaluation, but court records do not immediately indicate the result. Lee was convicted by a jury and served two weeks in jail. He was also ordered to stay 150 metres away from Discovery headquarters.