A pipe bomb that exploded in a Seaside Park, NJ, garbage can Saturday morning may have been the work of someone who “had it out for the Marines” who were scheduled to take part in a charity 5K race.

No one was hurt in the blast, but the incident forced the temporary lockdown of the boardwalk and beach area and cancellation of the race.

Three pipe bombs were tossed into the plastic garbage can, but only one detonated, at about 9:35 a.m. at D Street and Ocean Avenue, sources said.

Approximately 5,000 runners in the third annual Seaside Semper Five Marine Corps Charity 5K should have been passing the blast site when the pipe bomb went off, but the start of the race was pushed back due to some late registrations, officials said.

“Somebody had a beef with the military, being that it was a Marines-related event. They were obviously targeting the participants of the run,” said Ocean County Prosecutor’s spokesman Al Della Fave.

It’s unclear whether the motive was criminal or terrorist, he said.

The FBI, the Bureau of Alcohol, Tobacco, Firearms and Explosives, the Joint Terrorism Task Force and local law enforcement are investigating.

Police shut down a four-block area around the blast site, he said.

James Waters, the NYPD’s head of counterterrorism operations, tweeted, “We are closely monitoring the incident in #SeasidePark #NewJersey.”

New Jersey State Police later said there was nothing to reports of another explosive device near the site of the explosion.

The third annual Semper Five race was run by the nonprofit MARSOC Foundation.

With Post Wires