A Maryland man took five people hostage in an SUV and then opened fire at officers, provoking a gun battle that left bullet holes in the windows of a nearby elementary school, police said.

The incident appeared to start with an armed robbery that quickly escalated near 6th Street and Alabama Avenue SE, investigators said.

Luvell Alverson, 22, of Suitland, Maryland, is in custody.

An armed suspect approached four people in the 3200 block of 6th Street SE shortly before 12:15 a.m. and demanded their property, forcing them to the ground, police said. They complied, but the man fired multiple shots in their direction.

Police responded to the gunfire, but the man jumped into a nearby SUV that had five other people inside.

The robber held them hostage and tried to use them to escape before opening fire at officers, police said. The officers fired back and hit the suspect in the leg.

Despite his injury, the suspect ran off, but police said they later found and arrested Alverson.

The gunfight left the SUV riddled with bullet holes, as well as a blown-out side window and rear windshield. The nearby Martin Luther King Jr. Elementary School appeared to have seven bullets holes in its windows.

Alverson is charged with robbery (gun), kidnapping and assault on a police officer.

"When you have officers who are not in any way under any kind of protective that are fired upon, who take cover and then are fired upon again, it is a miracle we don't have dead police officers," said D.C. Police Chief Cathy Lanier.

Police had the victims in the SUV slowly exit with their hands up.

"And yes, the other individuals in that car, if you would imagine as a police officer arrives and approaches a car and bullets come flying out of that car, the officer has no idea who the other occupants in the car are," Lanier said. "All they know [is] that the shots are coming from that car.

Police took the hostages, who initially were considered possible suspects, in for questioning.

Neighbors say they felt like they were living in a war zone.

"Last night, it was kind of horrifying, because, you know, there were these random shots going off, and you could really tell there was a battle, a gun battle," said Michaelisa Jones. "So at that point, we just kind of took cover in the house and just waited until everything was over."

No victims or officers were injured.

Authorities said their investigation doesn't indicate this was part of a targeted attack on police.

Last week, an Army veteran fatally shot five police officers during a peaceful protest in Dallas, Texas, over the police killings of Philando Castile in Minnesota and Alton Sterling in Louisiana.