The gunman, 38, entered a business at Riverside Tech Park in the northeast of the city and opened fire in or near it, striking two men, Frederick Police Chief Jason Lando told reporters.
He then drove to Fort Detrick, about 10 minutes away, where “personnel on the base” fatally shot him, Lando said.
The men injured at the technology park were in critical condition, and were flown by helicopter to a hospital in Baltimore, Lando said
Lando said he didn’t know why the gunman opened fire at the business or subsequently went to Fort Detrick.
“We have two different scenes. … We have confirmed there (was) only one (assailant), (and) the public is no longer at risk,” Lando said.
The names of the gunman and the injured men weren’t immediately released.
The gunman was a Navy hospital corpsman, the US Navy said on Twitter.
Police were called around 8:20 a.m.
After the shooting, a victim entered a nearby business, Nicolock Paving Stones, and asked for help, a person there said.
“Our team was able to assist them and called the authorities,” a statement released by Jeremy Mutschler, director of marketing and advertising at Nicolock, reads. The statement emphasizes that the shooting did not happen at Nicolock.
Police haven’t named the business where the shooting took place.
Agencies helping Frederick police with the investigation include the FBI; the Bureau of Alcohol, Tobacco, Firearms and Explosives; Maryland State Police; and Frederick County Sheriff’s Office.
Frederick is about a 50-mile drive northwest of Washington, DC.
This developing story will be updated.
CNN’s Joe Johns, Amanda Watts and Michael Callahan contributed to this report.