BY NOMAAN MERCHANT

DALLAS (AP) – A man planted pipe bombs outside of Dallas’ police headquarters early Saturday before opening fire on the building and officers who tried to stop him, spraying the building and a squad car with bullets during a wild street battle but injuring no one.

After cornering the fleeing suspect’s van in the parking lot of a fast food restaurant in the suburb of Hutchins, a police sniper shot and killed him, police Chief David Brown said.

Authorities said they wouldn’t release the suspect’s identity until a medical examiner had confirmed it. At a news conference before they confirmed his death, Brown said the gunman had identified himself as James Boulware and had said he blamed police for having lost custody of his son and for “accusing him of being a terrorist.” The chief cautioned that it was possible the suspect didn’t give his real name.

Authorities said it was remarkable that no one else was killed or injured in the attack.

According to police, the suspect opened fire on the building from his parked van. Bullets pierced the glass at the entrance and caused damage inside, including at the front desk, where the worker on duty had just gone to get a soft drink.

He also fired on officers who drove up to confront him, riddling at least one squad car with bullets but not actually hitting anyone. Cellphone video shot from a nearby balcony or roof showed the suspect’s dark-colored van ram a squad car as gunshots rang out. The van then fled, eventually stopping in a restaurant parking lot in the suburb of Hutchins, where the standoff ensued.

The suspect had told police negotiators that he had explosives in the van, and Brown said at a news conference that the department decided to shoot him because it felt he still posed enough of a threat.

“When the negotiation was on, he became increasingly angry and threatening, such that we were not only concerned with our officers there trying to contain the scene being shot by him at a moment’s notice,” but also people nearby, Brown said.

Investigators found a package of pipe bombs in the parking lot at police headquarters and at least two more pipe bombs in the van, police said.

Wary that the van may have been rigged with explosives, police used a camera-equipped robot to inspect it rather than have officers approach it immediately, which was why it took several hours to confirm he was dead.

After the suspect was confirmed dead, the van caught fire while the authorities were detonating the suspected ordnance inside, police spokesman Maj. Max Geron tweeted on his official department Twitter feed.

The attack began at around 12:30 a.m., when several police officers were standing nearby. A popular bar across the street from the headquarters building was still open, and the neighborhood is also home to a boutique hotel and apartment buildings.

Many residents awoke to the sound of gunfire and sirens. In the early confusion, witnesses reported seeing as many as four attackers, including some who had taken high positions for better vantage points. Brown later said investigators were confident the only attacker was the suspect police later killed.

Anita Grendahl was asleep in her seventh-floor apartment in a high-rise across from police headquarters when she heard gunshots loud enough to wake her up over a white noise machine in her room.

“We just woke up to a few pops and thought somebody was on my balcony, and then looked outside and saw the van crash into the car,” she said.

Ladarrick Alexander and his fiancée, Laquita Davis, were driving back toward the police station to their nearby apartment when they heard 15 to 20 gunshots in quick succession.

Seconds later, police could be seen swarming an unmarked van that appeared to have crashed into a police car, they said.

They turned around and were parked outside the police perimeter about two blocks away, where they heard the sound of one detonation at about 4:30 am and smoke coming up in the air.

“We don’t see too much going around here at all,” Alexander said.