FREDERICK, Md. - A Navy medic shot and critically wounded two U.S. sailors at a military facility Tuesday, then fled to a nearby Army base where he was shot and killed, police and Navy officials said.

Fantahun Girma Woldesenbet, a petty officer third class assigned to Fort Detrick, began shooting with a rifle inside a Navy facility at the Riverside Tech Park, causing people inside to flee, Frederick Police and Fort Detrick officials said at a news conference.

Authorities said they were still trying to determine the shooter's motive and whether he knew the victims, two Navy sailors assigned to Fort Detrick, both of whom were airlifted to a hospital for treatment.

“We're still trying to sort through stacks of paper ... to figure out exactly what the motive would be,” said Frederick police Lt. Andrew Alcorn.

A hospital spokeswoman did not respond to an email asking for an update on the victims' conditions.

The suspect drove to the base after the initial shooting at the office park and was told to pull over to be searched by gate guards who had advance warning that he was coming, Brigadier General Michael J. Talley said. But Woldesenbet immediately sped off, making it about a half-mile into the installation before he was stopped at a parking lot by the base's police force. When he pulled out a weapon, the police shot and kill him, Talley said.

Talley said investigators will determine as much as they can, including why the suspect went back to the base.

“(I) don't know his mental status at the time, and we're certainly going to find all that out,” he said.

The brigadier general said the facility where the shooting took place was not under his command. He declined to identify the facility more specifically or describe the work that was done there.

Fort Detrick is home to the military's flagship biological defence laboratory and several federal civilian biodefense labs. About 10,000 military personnel and civilians work on the base, which encompasses about 1,300 acres (526 hectares) in the city of Frederick.

The base is a huge economic driver in the region, drawing scientists, military personnel and their families. Frederick Mayor Michael O'Connor noted that various defence contractors are located near Fort Detrick and that it wouldn't be unusual for a member of the military to be off base and working with a private firm that does business with the U.S. government.

“When these incidents happen in other places, you're always grateful that it's not your community,” O'Connor added. “But you always know, perhaps in the back of your mind, that that's just luck - that there isn't any reason why it couldn't happen here. And today it did.”

By early afternoon, the Nallin Farm gate at Fort Detrick through which the shooter entered remained closed and two officers were standing by.

Police cordoned off Woldesenbet's garden-style apartment building in Frederick City, a few miles from the site of the shooting.

A neighbour, Ava Target, said she knew Woldesenbet only by sight, and that he lived on the top floor of the apartment complex with a wife and two kids. She wasn't aware of any problems.

Mark Nelson, a firefighter who lives in a row of townhomes across the street from the base, said he heard the base blast warning sirens Tuesday morning.

“I heard, I don't know what they call it, but they were like air raid sirens, and I knew something was going on,” Nelson said.

Frederick Police Chief Jason Lando called the shootings “very tragic.”

“It's happening too frequently,” he said. Every time we turn on the TV we're seeing something like this happening. And now it's happening in our backyards.”

This story has been edited to correct that base personnel, not police, shot the suspect and to correct a word in the base spokeswoman's quote to “after,” not “before.” ---

Associated Press writers Michael Kunzelman in College Park, Maryland; Ben Finley in Norfolk, Virginia; and Jonathan Drew in Durham, North Carolina, contributed to this report.