A SWAT team was communicating with the gunman, who officials said had two boxes and two backpacks with him that may have contained explosives. After he barged into the building, he reportedly told everyone to stop moving. Several people ran out of the building, and three male hostages were taken.
Federal law enforcement officials believe the suspect was 43-year-old James Lee.
According to negotiators, the suspect said he had "a number of issues with Discovery." During the negotiation process, officers watched the suspect very closely. Sometime during the incident, the suspect pointed his handgun at one of the hostages. At that point, tactical units moved in and shot the suspect. He died of his injuries.
Koka Marchello of San Dimas knew Lee when they both lived in Maui 18 years ago. He said Lee was a loner who had been estranged from his family.
Lee lived in San Diego until 2004.
Koka Marchello of San Dimas knew Lee when they both lived in Maui, Hawaii, 18 years ago. He said Lee was a loner who had been estranged from his family.
"He did have a short temper," Marchello said. "Several years back he had some issues, unfortunately. He kind of disconnected from people. This is going back to the late 1990s where he had turned away from everybody.
Lee's brother, Aaron Lee, spoke to ABC News by telephone from his home in Indio, Calif.
"It's definitely out of character and I thought it was insanity," he said. "Sad to know that he was shot and killed. But I thought about it, and thought that, that's what he probably wanted."
Lee's brother in law said he also lived in Los Angeles.
On Wednesday night, bomb experts detonated the makeshift explosives Lee left inside the building.
Montgomery County Police Chief Thomas Manger said most of the 1,700 people who work in the building were able to get out safely.
Employees on the West Coast were told the gunman was holding up to six hostages, all believed to be security guards. A witness said they saw the gunman holding a security guard at his side, with hostages lying on the ground.
Cpl. Dan Friz of the Montgomery County Police Department said that at least 20 officers and several bomb technicians responded to the incident.
Authorities received a call of shots fired at 1 p.m. ET. Witnesses said there were five or six shots fired.
An e-mail was sent to employees that said, "We have reason to believe there is an armed gunman at One Discovery Place. All employees should seek protection in a locked office on their respective floors immediately."
According to ABC News, the building has a daycare center that was immediately evacuated.
A Discovery employee sent a text message that read, "Friends, I am in work closet with workers here. There is a shooter here at Discovery. I am OK."
Lee was arrested in 2008 by Montgomery County police after holding a protest against the Discovery Channel. Lee created the website www.savetheplanetprotest.com.
Lee was convicted of disorderly conduct after the protest he staged outside the Discovery Channel building in 2008. He spent two weeks in jail and was ordered to stay away from the building. He was also ordered to undergo a doctor's evaluation, but it's not clear if that ever happened.
The gunman had a longstanding grudge against the Discovery Channel that started after he lost his job in San Diego.
David Leavy, Discovery Communications Executive Vice President Global Communications and Corporate Affairs, released the following statement regarding the shooting:
"First and foremost, Discovery Communications wants to express how relieved and grateful we are that all employees and the children from the Discovery Kids Place daycare center are safe. Employees in Silver Spring demonstrated courage, compassion and cooperation throughout the situation, which aided law enforcement efforts -- for which we are thankful and proud.
In coordination with Montgomery County, Md., Police, an evacuation procedure was executed for all persons in the building. The evacuation procedures were handled with professionalism and with safety as Discovery's primary concern. Discovery thanks the Montgomery County Police and Fire & Rescue and other state and federal safety personnel whose quick thinking and fast action ensured the safety of the employees and children in the building as well as the Silver Spring, Md., community.
The events of today showed the strong heart of the Discovery family."
The Associated Press contributed to this report.