New Orleans police officers patrolling a Mother’s Day second-line parade Sunday were intent on preventing a repetition of the events during the same parade three years earlier, when gunfire left 19 people shot and a 20th injured in a stampede away from the flying bullets.

That state of alert helped cops arrest two 19-year-old men accused of illegally possessing guns along the parade route before any weapons could be fired.

Officers keeping an eye on the 1400 block of St. Bernard Avenue spotted four men wearing black jeans and white shirts with the words “Hard City” on them about 2:30 p.m., police said.

All of the men were “grasping the front of their waistbands (as) if they were concealing firearms,” and one of them — later identified as Dwine Hardy — shouted, “Them people coming,” as the officers approached them to investigate, a warrant says.

At that point, the four began running toward Marais Street.

An officer apprehended Hardy when he got to Marais and found a .40-caliber handgun in his waistband, police said.

Another officer chased a man identified as Melvin Robertson, who was accused of pulling a handgun out of his waistband and discarding it in the 1400 block of Columbus Street before he was captured on North Villere Street about two blocks away.

Aside from having the gun, police alleged, Robertson had two bags of marijuana in the right front pocket of his pants.

Hardy was booked on counts of illegally carrying a weapon as well as resisting police.

Officers jailed Robertson on counts of illegally carrying a weapon, possession of a firearm by a convicted felon, possession of marijuana, illegally carrying a weapon while in possession of drugs, resisting an officer and a probation violation, records showed.

The probable-cause affidavit supporting the arrests of Hardy and Robertson mentioned that the parade during which Sunday’s arrests were made was the same one that saw the infamous 2013 Mother’s Day shooting.

That shooting remains fresh enough in people’s minds that the organization that stages the annual parade, the Original Big 7 Social Aid and Pleasure Club, was asked by lawyers for the Columbia Parc housing development to alter its route this year to avoid that neighborhood.

City officials intervened and the group was allowed to follow its traditional route. In the end, a crowd of hundreds enjoyed the revelry without incident beyond the foot chases that led to the arrests of Hardy and Robertson.

Two of four brothers who earlier this year pleaded guilty in federal court to having criminal roles with the Frenchmen and Derbigny drug gang have admitted to spraying gunfire into the crowd watching the Mother’s Day second-line in 2013.

Akein and Shawn Scott admitted to firing guns during that parade in an attempt to take out an associate of a rival group named the Prieur Columbus Boys, prosecutors said.

A judge sentenced Akein Scott to life in prison and gave Shawn Scott 40 years behind bars.