Snipers gunned down five police officers and injured seven others during protests over two fatal police shootings of black men — an explosion of violence described as the deadliest day for law enforcement since 9/11.

One suspect died after a tense standoff with cops in an El Centro College garage, law enforcement sources said. It was unclear if the suspect was killed or had shot himself.

Two civilians also were wounded, including Shetamia Taylor, 37, who was shot in the calf and was undergoing surgery Friday morning, Mayor Mike Rawlings said.

Four of the slain cops were members of the Dallas Police Department and one was a Dallas Area Rapid Transit cop, officials said.

One of the slain members of the Dallas police force was identified as Patrick Zamarripa, a young father who described himself on Twitter as “addicted to the thrill of this job.”

DART identified its dead officer as Brent Thompson, 43, who joined the department in 2009.

“Our hearts are broken,” department spokesman Morgan Lyons said in a statement. “This is something that touches every part of our organization. We have received countless expressions of support and sympathy from around the world through the evening. We are grateful for every message.”

Three other DART officers were wounded but were expected to survive, Lyons said.

Three people, including a woman, were in custody before the fourth suspect’s death, Dallas Police Chief David Brown said Friday morning.

The woman was nabbed in the same parking garage where the standoff was ongoing, Brown said. The others were arrested during a traffic stop.

The gunfire broke out around 8:45 p.m. Thursday while hundreds of people were gathered to protest fatal police shootings this week in Baton Rouge, Louisiana, and suburban St. Paul, Minnesota.

Brown said earlier that the suspect had “told our negotiators that the end is coming, and he is going to hurt and kill more of us, meaning law enforcement. And that there are bombs all over the place in this garage and in downtown.”

A SWAT team and bomb-sniffing dogs had been deployed to the scene and stun grenades were used during the standoff.

Dallas police Maj. Max Geron said on Twitter that authorities were conducting “extensive” sweeps across the downtown area, which was on lockdown.

Brown said police believed the snipers had shot at police ambush-style from high points during an otherwise peaceful protest.

Protests were also held in other cities — including New York City — across the country Thursday night after a Minnesota officer on Wednesday fatally shot Philando Castile while he was in a car with his girlfriend and her 4-year-old daughter.

Castile’s girlfriend, Diamond Reynolds, livestreamed the bloody aftermath of the shooting in a widely shared Facebook video that sparked widespread shock.

A day earlier, Alton Sterling was shot in Louisiana after being pinned to the pavement by two white cops. That shooting also was captured on a cellphone video.

In midtown Manhattan, protesters first gathered in Union Square Park, where they chanted “The people united, never be divided!” and “What do we want? Justice! When do we want it? Now!” In Minnesota, where Castile was shot, hundreds of protesters marched in the rain from a vigil to the governor’s official residence. Protesters also marched in Atlanta, Chicago and Philadelphia.

Video from the Dallas scene showed protesters marching along a downtown street, about half a mile from City Hall, when shots were fired and the panicked crowd scattered for cover.

President Obama said from Warsaw, where he is attending a NATO summit, that America is “horrified” over the shootings and there’s no possible justification for the attacks.

Presumptive GOP presidential nominee Donald Trump reacted to the shooting in a Friday morning Tweet.

“Prayers and condolences to all of the families who are so thoroughly devastated by the horrors we are all watching take place in our country,” he wrote.

Hillary Clinton, the presumptive Democratic nominee, tweeted Thursday night: “Too many African American families are mourning. Too many young black men and women have been taken from us.”

The wounded DART officers were identified as Omar Cannon, 44, Misty McBride, 32, and Jesus Retana, 39, the Dallas Morning News reported.

Three Dallas police officers were in critical condition, and two of them had undergone surgery, authorities said.

Taylor, the wounded civilian, attended a rally downtown with her four teenage sons. Her sister, Theresa Williams, said Taylor threw herself over her sons when the gunfire erupted.

The search for the shooters stretched throughout downtown, an area that is only a few blocks away from Dealey Plaza, where President John F. Kennedy was assassinated in 1963.

Warning: Graphic content

Some of the injured cops were taken to Parkland Hospital, the same hospital where Kennedy was taken.

The scene was chaotic, with helicopters hovering overhead and cops with automatic rifles on the street corners.

“Everyone just started running,” Devante Odom, 21, told the Dallas Morning News. “We lost touch with two of our friends just trying to get out of there.”

Carlos Harris, who lives downtown, told the paper that the shooters “were strategic. It was tap, tap pause. Tap, tap pause,” he said.

Brown said police don’t have a motivation for the attacks or any information on the suspects.

He said they “triangulated” in the downtown area and had “some knowledge of the route” the protesters would take.

Video posted on social media appeared to show a gunman at ground level exchanging fire with a police officer who was then struck.

Texas Gov. Greg Abbott released a statement saying he has directed the Texas Department of Public Safety director to offer “whatever assistance the City of Dallas needs at this time.”

“In times like this we must remember — and emphasize — the importance of uniting as Americans,” Abbott said.

Mayor Rawlings called for unity amid the bloodshed.

“We as a city, we as a country must come together, lock arms and heal the wounds that we all feel from time to time,” he said. “Words matter, leadership matters at this time. I’m proud of our chief.”

Rawlings asked everyone to focus on the officers and their families.

“It is a heartbreaking morning to lose these … officers who proudly served our citizens,” Rawlings said. “To say that our police officers put their lives on the line every day is no hyperbole, ladies and gentlemen. It’s a reality.”

With Post wires