WASHINGTON — The 34-year-old former Navy electrician’s mate identified as the gunman who killed 12 people at the Washington Navy Yard had been discharged from the service in 2011 after multiple disciplinary infractions, a Navy officer said Monday.

Aaron Alexis “had a pattern of misconduct,” the official said.

Law enforcement officials have identified Alexis as the shooter who went on a two-hour rampage at the sprawling naval base in Washington, but have not yet said what they believe was his motive.

Alexis, a native of New York, who served in the Navy from 2007 to 2011 as an aviation electrician’s mate 3rd class, entered the base early Monday morning, authorities said, perhaps using another man’s identification card to pass through the gates.

Once inside, officials said, he headed for the massive Building 197, the headquarters of the Navy Sea Systems Command. Armed with three weapons, including an AR-15 assault rifle, he went to the building’s fourth floor, according to officials. About 8:15 a.m., according to witness accounts and police dispatch recordings, the gunman began shooting down into a crowded atrium that houses an employee cafeteria.

Washington police and Navy security officials engaged in “multiple” exchanges of fire with Alexis over the next two hours, Metropolitan Police Department Chief Cathy Lanier told reporters, eventually shooting and killing him.

LIVE: Real-time Twitter updates

In addition to the 12 people killed, three others were treated at a hospital, with two requiring surgery. All three are expected to recover, hospital officials said. Officials said other people may have suffered injuries that did not require hospitalization.

From 2008 until his discharge in 2011, Alexis was a member of an aviation support squadron based in Fort Worth, Texas, where he worked on C-40s, a military version of the Boeing 737 that the Navy uses as a cargo plane. Law enforcement officials said that he was more recently working as a military contractor.

On Sept. 5, 2010, he was arrested in Fort Worth on suspicion of discharging a weapon. Alexis reportedly told officials that the gun had discharged accidentally when he was cleaning it. The Tarrant County district attorney did not prosecute.

Earlier Monday, Lanier had said that investigators were seeking two other men. One, a white man dressed in military-style clothing who had reportedly been seen with a handgun in the vicinity of the shooting on the base, was cleared in mid-afternoon.

D.C. Mayor Vincent Gray said the police department still wanted to speak to a second man who some witnesses had reported seeing, a black man in his 50s dressed in olive fatigues. But he played down the possibility that the man was involved in the shooting.

“We don’t know that there is a second gunman on the loose,” Gray said at a news conference, adding that police wanted to talk to the man.

PHOTOS: At the scene of Navy Yard shooting

Gray also repeated earlier statements that police had no evidence linking the attack to terrorism.

About 3:30 p.m., officials began to allow people to leave the base, which had been on lockdown.

President Obama, speaking at the White House, praised the victims as “patriots” who “know the dangers of serving abroad” but faced “unimaginable violence they wouldn’t have expected at home.” He promised that federal and local law enforcement officials would work together to investigate.

Dr. Janis Orlowski, chief operating officer at MedStar Washington Hospital Center, reported three shooting victims at the hospital but added that they expected to admit more victims.

"From the reports of the victims, it had to be a semiautomatic," she said. "They’re talking about gunshots that they heard in rapid succession."

One woman admitted to the hospital had a gunshot wound to the head and her hand, Orlowski said. Another woman had a wound to her shoulder, Orlowski said, and a D.C. police officer had multiple gunshot wounds to his legs.

The three were in critical condition, she said, but she described their chances for survival as good.

The incident began at about 8:15 a.m. at the headquarters of the Naval Sea Systems Command at the sprawling naval base on Washington’s Anacostia River waterfront.

Patricia Ward, a logistics management specialist, was in Building 197 when the shooting started. She told reporters she was in the lobby using the ATM when she heard three shots and started "panicking." Then she heard four more shots. A security guard with a gun drawn told people to run, she said, and "I just ran. I thought of my family and I just ran." Someone pulled the fire alarm.

Roughly two hours later, witnesses reported hearing more shots.

A federal law enforcement official monitoring the situation said that conflicting reports of more than one gunman came from a situation where a “second building” was being checked for reports of shots fired.

Officials ramped up security in all federal buildings in the Washington area. As a precaution, U.S. Capitol Police added personnel and increased security measures in the Capitol Building.

As helicopters hovered above the base, first lowering stretchers to airlift victims to hospitals and later circling the base in an apparent search effort, air traffic was briefly grounded at the nearby Reagan National Airport. Several area schools were put on lockdown.

About 3,000 people, both civilian and military, work at the Naval Sea Systems Command Headquarters.

Navy Capt. Danny Hernandez said he was in an adjoining Navy Yard building when the shooting started.

“Everybody rushed in” to the building where he was, and security guards locked down the facility. “It was pretty orderly,” he said.

[For the Record, 8:33 a.m. PDT Sept. 16: An earlier version of this post incorrectly identified Navy Capt. Danny Hernandez as Navy Capt. Danny Rodriguez.]

[For the Record, 10:14 a.m. PDT Sept. 16: An earlier version of this post quoted Patricia Ward as saying metal detectors were in place at Building 197. There are not.]

ALSO:

Miss New York wins Miss America pageant

Coast Guard rescues men lost at sea for 8 days

Rain continues in Colorado, thwarting air rescues

Reporters Alexei Koseff and Richard A. Serrano contributed from Washington.

Follow L.A. Times National on Twitter

Twitter: @richardsimon11

Twitter: @bybrianbennett

richard.simon@latimes.com

david.cloud@latimes.com

brian.bennett@latimes.com