Police respond to the shooting in Frederick, Maryland, on Tuesday morning.
CNN  — 

A Navy sailor shot and wounded two other sailors at a facility in the Maryland city of Frederick on Tuesday morning before driving to the US military’s nearby Fort Detrick, where police shot and killed him, authorities said.

The US Navy tweeted that the shooter was a Navy hospital corpsman, and Fort Detrick officials told CNN that he was posted at that installation.

They identified him as Fantahun Girma Woldesenbet, whose rank was E-4.

“We are still investigating motive, investigating the exact circumstances,” Army Brig. Gen. Michael J. Talley told reporters at an afternoon news conference.

The gunman was stopped at the post’s gates, but before the vehicle could be searched the shooter took off. He was stopped about 1/2 mile onto the installation, where he got out of the car, brandished a weapon and was shot by police, Talley told reporters.

Frederick Police Chief Jason Lando said the first shooting took place at “a military institution” in the Riverside Tech Park. In a news release, the police department said the building is a warehouse rented by Naval Medical Research Center, Biological Defense Research Directorate to store research supplies and equipment.

The chief said the gunman used a rifle but did not provide any additional information on the weapon.

One victim is in critical condition but is stable at a hospital. The second victim is in serious condition but likely will be released Wednesday. Both were taken from the scene by helicopter, police said.

Police were called around 8:20 a.m.

Police had been called to the first scene, about a 4-mile drive east of Fort Detrick, around 8:20 a.m., Lando said earlier. “We know some people fled from the business,” Lando said.

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.

Agencies helping Frederick police include the FBI; the Bureau of Alcohol, Tobacco, Firearms and Explosives; Maryland State Police; and the Frederick County Sheriff’s Office.

The FBI is handling the first shooting scene, officials said.

Frederick is about a 50-mile drive northwest of Washington, DC. Woldesenbet did not live on Fort Detrick, officials said.

Fort Detrick is an Army biomedical and research facility. There are elements of other military branches on the post. According to the website Military Installations, there are about 1,300 active-duty military and 8,500 civilians and contractors at Fort Detrick or the Forest Glen campus in Silver Spring, Maryland.

CNN’s Joe Johns, Amanda Watts and Michael Callahan contributed to this report.