Witnesses first reported the man roaming around near the courthouse with a gun in a bag at about 10:15 a.m. EST, News 13, Orlando, Fla., reported.
Deputies said they had known the man was coming to the courthouse and approached him when they saw him. They said as they drew near, he pulled a handgun from a bag, waving it at spectators and yelling at the officers, the TV station said.
The courthouse was put on lockdown and two schools -- Viera High School and Viera Charter School -- were also put on lockdown.
A Palm Bay police officer who happened to be at the courthouse was reported to be negotiating with the gunman, and Brevard County Sheriff Wayne Ivey said deputies tried to talk the gunman into ending the situation peacefully.
News 13 said shots were fired at about 12:50 and Ivey confirmed at about 1:30 the gunman was shot and killed in the confrontation.
The schools re-opened at 2 p.m. but the courthouse was ordered closed until Monday.
Astronomers offer more expansive view of universe
McPhee, Cokas 'working on their marriage' after affair