The man who opened fire on Dallas police headquarters early Saturday, riddling the building and a squad car with bullets from an armoured van, is dead, police confirmed.

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, Dallas Police Chief David Brown said.

<a href="https://twitter.com/hashtag/Breaking?src=hash">#Breaking</a> We can now confirm that the susp in the van is deceased but unable to confirm ID pending Med Ex. identification <a href="https://twitter.com/hashtag/DallasPDShooting?src=hash">#DallasPDShooting</a> —@MaxDPD

<a href="https://twitter.com/hashtag/BREAKING?src=hash">#BREAKING</a> Lots of shrapnel was included in the pipe bombs that exploded - screws, nails <a href="https://twitter.com/DallasPD">@DallasPD</a> HQ <a href="https://twitter.com/hashtag/DallasPDShooting?src=hash">#DallasPDShooting</a> —@MaxDPD

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."

A Dallas SWAT officer walks to his vehicle at the intersection of Interstate 45 and E Palestine Street, where police cornered the suspect in his van on Saturday. (Ashley Landis/The Dallas Morning News via AP)

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-coloured van ram a squad car as gunshots rang out. The van then fled, eventually stopping in the restaurant parking lot in Hutchins, where the standoff ensued.

Father says son had strong feelings against police

The father of the man, also named James Boulware, says his son had strong feelings against law enforcement. He said Boulware spent several hours at the father's home in Carrollton, a Dallas suburb, a day before the shooting and talked about how well his recently-purchased van drove.

He also discussed a widely-publicized video of a police officer in McKinney, Texas pushing a black teenager to the ground and brandishing his gun at other teenagers. Boulware was angry after he lost custody of his son, now 12 or 13 years old, the father said.

The father said he last spoke with Boulware by telephone about three hours before Dallas police said the shooting began.

"Not being able to get a job and the legal system letting him down, (he) finally snapped," the elder James Boulware said in a telephone interview with the Associated Press. "But I can't say shooting at a police station is right in any way."

Police tried to negotiate

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.

The shooter who opened fire on Dallas police headquarters declared himself to be James Boulware, seen here, but police were still working to confirm that. (Dallas County Sheriff's Department )

"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.

Officers were wary of approaching or entering the van, though, because of the potential explosives.

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.

Police used a camera-equipped robot to inspect the vehicle 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, Geron tweeted on his official department Twitter feed.

Gunfire rattled residents

Police block the intersection of Dowdy Ferry Road and Interstate 45, just south of Dallas, during a standoff with a gunman barricaded inside a van, used in an overnight shooting outside the Dallas police headquarters. (Brandon Wade/Associated Press) The attack began at around 12:30 a.m. CT, 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.

.<a href="https://twitter.com/jdmiles11">@jdmiles11</a> Yes 2 into engine block 3rd shot hit suspect through windshield. All w/.50 cal <a href="https://twitter.com/hashtag/DallasPDShooting?src=hash">#DallasPDShooting</a> —@MaxDPD

<a href="https://twitter.com/hashtag/BREAKING?src=hash">#BREAKING</a> inside <a href="https://twitter.com/DallasPD">@Dallaspd</a> HQ riddled with bullet holes <a href="https://twitter.com/hashtag/DallasPDShooting?src=hash">#DallasPDShooting</a> <a href="http://t.co/jIZqd78di9">pic.twitter.com/jIZqd78di9</a> —@MaxDPD

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.

<a href="https://twitter.com/hashtag/DallasPDshooting?src=hash">#DallasPDshooting</a> suspect's dad's first words from my interview just moments ago <a href="http://t.co/nqrYnquAUQ">pic.twitter.com/nqrYnquAUQ</a> —@jdmiles11

A video of the incident on social media showed a police officer approaching a black van with a flashlight as two other police cruisers pulled up behind the vehicle. The officer then abruptly turned and ran away and then a volley of gunshots could be heard.

In another video, the van could be seen ramming a police cruiser before gunfire rang out and the vehicle drove off.

There are reports the van appears to be outfitted with gun ports in the sides.

Police are reportedly investigating whether it is the same armoured van that was sold on eBay as a "zombie apocalypse assault vehicle" last week.