ATLANTIC CITY — A New Jersey judge has dismissed a lawsuit filed by the family of a man who died when the sand under his feet collapsed as he walked along the shoreline, plunging him into the swirling waters of an inlet.

Superior Court Judge John Porto dismissed a lawsuit Tuesday brought by the family of Brad Smith, of Horsham, Pennsylvania, who died in July 2012. The family sued the city of North Wildwood and the state of New Jersey.

The judge cited state law granting immunity to governments from injuries occurring on unimproved public property, or land that is in its natural condition. He ruled that conditions at the Hereford Inlet in North Wildwood were naturally occurring, and ended the litigation against the city and state.

Two other people died in a nearly identical manner three years earlier, but they were not part of the lawsuit.

"This was a very tragic set of facts," the judge said. "That's not overlooked by the court."

But he ruled that New Jersey legislators were clear when they enacted a law regarding suits against public entities that governments cannot be sued for injuries sustained by members of the public on land that, while owned by a town or state, has not been altered by those governments.

Porto ruled that the inlet, by definition, is constantly shaped and re-shaped by the actions of wind, currents and tides. Man-made improvements located 400 feet to 600 feet from the water's edge, including a sea wall, did nothing to alter conditions along the inlet's edge, or to cause a dangerous condition that did not exist before, he said.

Smith was walking in ankle-deep water at the beach with his daughter when the sand collapsed, plunging them and a friend into the swirling waters. A passer-by on a personal watercraft rescued the girl, who was being held above the waves by her father before he drowned.

Three years earlier, Jamila Watkins and 15-year-old Shayne Hart were walking along the water's edge when the sand gave way beneath them, plunging them into the swirling waters of the inlet, killing both of them.

Paul D'Amato, a lawyer for Smith's family, presented pre-trial statements from North Wildwood beach patrol officers that said they knew potentially dangerous conditions existed at that particular spot along the inlet, and that similar tragedies were likely to happen again.

"We started this case so that no other family would have to go through what they did," D'Amato said afterward. "It's just an incredibly sad day."

He said the Smith family would appeal the dismissal of the lawsuit.

(Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)

More From 92.7 WOBM