TOMS RIVER, N.J. — Investigators have determined that the devastating fire that consumed several blocks of the Boardwalk in nearby Seaside Park last week was caused by an electrical wiring problem, and was not set intentionally.

But the hidden culprit may well have been Hurricane Sandy.

On Tuesday, county officials declared the fire accidental, saying it was caused by a malfunction of electrical wiring that may have been compromised by water and sand from the hurricane last fall.

The Ocean County prosecutor, Joseph D. Coronato, said he would close the criminal investigation into the fire because the team of local, state and federal investigators had “unanimously determined” that it had not been started intentionally. Indeed, he added, the sand piled up under the Boardwalk left the spot where the fire broke out “completely inaccessible” to humans.